Test the call order of the-unity component

Source: Internet
Author: User

The previous 2 tests the order of the Gameobject, as well as the timing of awake and onenable:

Unity script Execution Sequence test in the hierarchy Panel 1

Http://www.cnblogs.com/hont/p/4298110.html

Unity script Execution Sequence test in the Hierarchy Panel 2

Http://www.cnblogs.com/hont/p/5034419.html

"Unity script in order of execution in the hierarchy Panel Test 1" To get a conclusion:

1. Non-prefab gameobject, the execution sequence is related to the time that he was created, and the later the execution order of the creation is the higher priority.

2.Prefab gameobject, the execution sequence is down from the root node.

I thought the components were in the same order as Gameobject, but the results were very surprising. Whether non-prefab or prefab, the execution order is related to the creation time

Non-prefab:

Prefab:

So, since the order of creation, change the order of execution can be so: (measured, it is best not to directly change the source files, the order of the source files more chaotic ...)

First create a script with key A3, then A2, and then A1. Then swap the script order.

In this way, the creation time is sorted by: A3->A2->A1

Test the call order of the-unity component

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.