Hello, I have what is probably a simple question:
If I switch scene in a function. how can I do next code:
public void YouWin(){
SceneManager.LoadScene ("youWin");
GameObject.Find ("TotalScore").GetComponent<TextMesh> ().text = "Total " + GameObject.Find ("guiScore").GetComponent<TextMesh>().text;
I did it by checking in OnLevelLoaded() weather GetActiveScene().name matches “youWin” string and then running that same line, but I would like to avoid checking every time, especially when I know it needs to be executed just once, exactly then
Thanks!
PS: “guiScore” is persistent 3DText, “TotalScore” is also 3DText that exists only on “youWin” scene. This function is in a script of a persistent GameManager empty object.