码迷,mamicode.com
首页 > 移动开发 > 详细

Application.LoadLevel & Object.DontDestroyOnLoad

时间:2014-06-25 19:43:36      阅读:254      评论:0      收藏:0      [点我收藏+]

标签:des   style   blog   http   color   com   

Application.LoadLevel

  bubuko.com,布布扣

  只有在File->Build Setting中设置了的按钮才能被加载。

  当level加载完成后,MonoBehaviour.OnLevelWasLoaded is called on all active game objects。

  When loading a new level all game objects that have been loaded before are destroyed. If you want to let an object survive when loading a new level, use Object.DontDestroyOnLoad.

  Calling LoadLevel will update Application.loadedLevel and Application.loadedLevelName

参考:file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/Application.LoadLevel.html

Object.DontDestroyOnLoad

  When loading a new level all objects in the scene are destroyed, then the objects in the new level are loaded. In order to preserve an object during level loading call DontDestroyOnLoad on it. If the object is a component or game object then its entire transform hierarchy will not be destroyed either.

参考:file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/ScriptReference/Object.DontDestroyOnLoad.html

Application.LoadLevel & Object.DontDestroyOnLoad,布布扣,bubuko.com

Application.LoadLevel & Object.DontDestroyOnLoad

标签:des   style   blog   http   color   com   

原文地址:http://www.cnblogs.com/tekkaman/p/3805671.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!