Incorrect usage of “an” in these docs.
It could also do with a better description. A friend of mine was not sure whether his functions would be called after/before every scene load or only once, at the start of the runtime.
Incorrect usage of “an” in these docs.
It could also do with a better description. A friend of mine was not sure whether his functions would be called after/before every scene load or only once, at the start of the runtime.
Hi Leslie - I posted a bug about this earlier in the month, just forgot to let you know. I’ll take a look and see if there is something easy to do here. (Not something I have used before.)
Ah… So:
using UnityEngine;
using UnityEngine.SceneManagement;
public class ExampleScript : MonoBehaviour {
MyClass myClass;
Scene scene;
void Awake()
{
scene = SceneManager.GetActiveScene();
Debug.Log("ExampleScript: Awake: " + scene.name);
}
void Start () {
Debug.Log("ExampleScript: Start");
}
}
Hmm. Now not 100% sure that the script should be added to the cube. Conceptually for me it feels more accurate that the script is on the scene, but that’s not do-able. Graham-the-worrier. ![]()
Okay, so now I am 100% sure that the MyClass.cs script from the doc page doesn’t need to be attached to anything. It’s available to the game start-up. I can’t see any way that the MyClass.cs code can be used by any scene. It’s really about the game starting (only). Line 6 in the script up there should be deleted.