Unity Learning Notes-Common scripting functions

Source: Internet
Author: User

1. Awake () Start () Update () fixedupdate ()

Unity is single-threaded, and for unity background scripts, the awake, Update, Lateupdate, and fixedupdate of each scripthave a block in the background. put each

Awake in the background ()

{

Awake () in script 0;

Awake () in script 1;

Awake () in script 2;

}

Backstage methods Awake, update, Lateupdate, Fixedupdate, and so on are in order, and so on all sub-scripts in the awake after the execution of the Start, update, Lateupdate and so on. So here's an explanation of unity's lack of multi-threading concepts.

Update in the background ()

{

Update () in script 0;

Update () in script 1;

Update () in script 2;

}

The awake function is executed before the script is enabled, and start is not executed until the script is enabled. Generally speaking, the variable refers to the script, and so on, in awake. The first action on the object can be placed in start

2. Vectors

In two-and three-dimensional coordinate systems, vectors can be labeled in positions with both direction and length. Speed is directional, and velocity has no direction, so vectors can also represent speed. A position vector Vector3 (5,6,0), a velocity vector Vector3 (4,6,0), that represents moving in the x direction every hour 4, 6 in the Y direction. Then the current position vector Vector3 (5,6,0) + speed vector Vector3 (4,6,0) is the position of the object one hour after Vector3 (9,12,0).

3. Linear interpolation

A linear interpolation between two values is useful in developing some games. Unity can use LERP () to implement interpolation functions. Linear interpolation calculates the value of a scale between two values. Between 3,5, the linear difference of 50% is equal to 4. Unity has several different types of lerp () functions. Like what

4. Displacement Rotation Translate () Rotate ()

5.LookAt ()

6. Deltatime

7.Destroy ()

8.Input class Getbutton () GetKey () Getaxis () OnMouseDown ()

9.Invoke ()

10.Invoke ()

Unity Learning Notes-Common scripting functions

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.