A little question about LoadLevel

After calling LoadLevel, the Awake and Start functions are called again? . I am having a problem after using LoadLevel but it only hapens in the stand alone version (weird).

HTWarrior

Awake and Start is called only once during the lifetime of the object.

Thus when you mark an object to not be destroyed when loading a level, you will not get another call to Start or Awake.
You can override OnDidLoadLevel for that purpuse.

Just to help clarify – this means that objects that get recreated when a level loads will have the Awake() and Start() functions called.

So, Awake() and Start() are called exactly once each after an object is created.

Objects can be marked so they persist between level loads. This is done through the DontDestroyOnLoad() method. (This is usually done for “global” objects like game manager classes.)

After reviewing my code I have realized that I have a rare problem. I am using the wayponts as described in the car tutotial . When executing my race game in the authoring system all is ok , once one race is over my code execute a LoadLevel and all is ok again. The objects begin in waypont = start and continues a new game. However, when executing the build the firts time all is ok ( as in the authoring system) once the race is over the code executes a Load level and it seems as if the OnTriggerEnter doesn’t works anymore so my objects don’t go to the next waypoint and begin to move around the first waypoint.Is this a bug ?. It is supposed that the game behavesi the same way in the authoring system and in the build (aside of fps of course).

HTwarrior

It was my fault! I was executing Loadlevel from one of the objects!!!. Now I am using a GameController that never is destroyed and all is working fine.

Thanks anyway
HTwarrior