Several methods of unity scene loading and object disappearing

Source: Internet
Author: User

Scene Loading:

Application.loadlevel (Application.loadedlevel); Recall scene

Application.loadlevel (0); Call the scene you placed in the settings, adjust the order of your

Preserves the currently specified object after the scene is loaded, leaving it to the next scene:

Dontdestroyonload (Transform.gameobject);

End Game:

Application.Quit ();

// is to control whether an object is rendered or displayed on the screen  and the object is actually still present Gameobject.destroy ()  ,which is still present when the object itself is invisible. A component that removes an object or object represents the destruction of the object  . Actually, the memory of the object is not released immediately but the memory resource is freed in the next scenario, that is, you are destroy in a scene. The memory resources of the object are actually released in the C scene (this is my experience Do not know the understanding of the errorgameobject.active   // whether to deactivate the object in the scene in   your gameobject.active =false You can't find the object  in the scene with Find // If the object has a sub-object you need to use setactiverecursively (false) to control whether the object is deactivated in the scene (recursive) 

Reference from: http://blog.csdn.net/fzhlee/article/details/8687712

Several methods of unity scene loading and object disappearing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.