- Home /
How Stop Update function of other scene
Hello I have a game that have 2 scenes and at each one of them unity3d editor profiler window show other scene update functions working and waste CPU how could I stop them from this scene? Should I use disable/enable scripts on loading levels and how shall I do it? thanks in advance
Answer by $$anonymous$$ · May 07, 2015 at 07:12 AM
You can check right in the first line in your Update() method:
private void Update()
{
if (Application.LoadedLevel == SOME_INDEX) return;
// some of your other code here
}
This code will skip rest of your Update code if SOME_INDEX matches scene index you want to skip update in
Your answer
Follow this Question
Related Questions
Major Error - Unity ninja's required !!! - Scene + Script"freezes" 2 Answers
Update from Unity 4 to Unity 5.4.1 Scene Crashing 2 Answers
change prefabs in scene? 0 Answers
Problem with restarting the scene (js) 2 Answers
UNITY3D SCENE REMOVED?! 0 Answers