1
votes

i have a plane with a material on it; the material moves its offset so to appear like it's animating.

i would like to create a 'loader' between scenes and while loading the next level with

Application.LoadLevelAsync

i would like the loading animation on my plane to persist on my screen.

i tried not destroying the plane on which i animate using

DontDestroyOnLoad(GameObject.Find("planeWithAnimation"))

but the plane still dissapears on the next level load. What can i do so that my gameObject planeWithAnimation doesn't get destroyed and still is able to iterate throw the script attached to it?

1
Heads up - the "unity" tag that you used is for the unity IoC framework. I think you meant "unity-3d," but I'll let you decide.Nick Vaccaro
@Norla thanks, meant to type unity3dAlex
@BadescuAlexandru You're on the right track. Check if there is a game object called planeWithAnimation (if... != null) and that there is one instance only.Kay
I think your code is all right,are you sure the code"DontDestoryOnLoad(gameObject)" has runned before the level loaded?chen yang

1 Answers

0
votes

I believe you need to call DontDestroyOnLoad from a script attached to the GameObject ( your plane ) you want to retain between loads like:

DontDestroyOnLoad(this.gameObject);

At least this is how we used it and it works fine. We have an application context that's persistent throughout the levels. This is either called on Start or Awake.

hth