-
Notifications
You must be signed in to change notification settings - Fork 46
Getting buildIndex from SceneReference #10
Comments
Currently the code is written with the assumption for you to use the Since the index can change we'd want to hold onto the Would require a bit of moving stuff around so that it happens as part of the |
I'll be here patiently waiting then :D |
+1 for this. Build index would be amazing! |
You can get the build index using SceneUtility.GetBuildIndexByScenePath. This works without needing to reference UnityEditor, so you can use this in-game. public SceneReference scene;
public void MyMethod()
{
// buildIndex = -1 when scene is not included or is disabled in the build settings.
int buildIndex = SceneUtility.GetBuildIndexByScenePath(scene.ScenePath);
} |
Heya, love the code, but I'm finding I'd have an easier time implementing it in my projects if there was a way to get a reference to the buildIndex of the SceneReference instance I am dealing with :)
The text was updated successfully, but these errors were encountered: