Untiy3d life cycle

Source: Internet
Author: User

Just began to learn u3d, combined with web stickers to write their own a little superficial understanding:

A script for a game component has a lifecycle--an initial instantiation until the end instance is destroyed. During this time, they are sometimes active, sometimes inactive, and sometimes visible to the user and sometimes invisible to the activity.

Now let's look at each method's

Onawake method: Awake is invoked when a script instance is loaded

OnStart method: Start is invoked only before the update function is invoked for the first time.

Onuupdate method: Called before rendering a frame. This is where most of the game code is executed, in addition to physical code

Ongui method: Call when rendering and handling GUI events Here's not all frames are called OH

Fixedupdate method: This function is invoked once per physical time step. This is where the physical game behavior is based.

Lateupdat method: Is invoked after all update function calls. This can be used to adjust the order in which scripts are executed. For example: When an object moves in update, the camera following the object can be implemented in Lateupdate

Reset method: Reset to default value

Ondisable method: This function is invoked when an object becomes unavailable or inactive.

OnDestroy method: When Monobehaviour will be destroyed, this function is called

A new understanding of the follow-up will be added in succession.

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.