- Home /
If(Application.isPlaying == "MainMenu") then Show A messenger. take a info
Hi! i want to make a general Script for 2 Scenes
If i put this code to an empty object then i have want show me a messenger like "Nice To Meet Ya" at scene with name "MainMenu" and one different scene with name "FirstPlane" to show me the Debug Logs messenger "Love you".
my code is as following:
function Update () {
if(Application.isPlaying == "MainPage") {
Debug.Log("Nice to Meet Ya");
}
if(Application.isPlaying == "FirstPlane") {
Debug.Log("I am bored");
}
}
but when i am trying to start PlayMode i didn't see to control any messenger. Why?
Answer by cagezero · Apr 29, 2013 at 02:24 AM
The Application function you are calling can't be used that way.
http://docs.unity3d.com/Documentation/ScriptReference/Application-isPlaying.html
Instead try using
http://docs.unity3d.com/Documentation/ScriptReference/Application-loadedLevelName.html
That will allow you to test which level is loaded.
I hope this has helped. If you consider your question resolved, please consider marking the answer as correct.