Unity3d Script Manual

Source: Internet
Author: User

Translation: script _ Tree

This was a short overview of how scripting inside Unity works.

Scripting inside Unity consists of attaching custom script objects called behaviours to game objects. Different functions inside the script objects is called on certain events. The most used ones being the following:

This is a brief overview of how the script works in Untiy.

Scripts in unity consist of attaching custom script objects to game objects. Different functions are called within a script object in a particular event. The following are most commonly used:

Update:

This function is called before rendering a frame. This is where the most game behaviour code goes, except physics code.

This function is called before running a frame, which is where most of the game behavior code executes, except for the physical code.

Fixedupdate:

This function is called once every physics time step. This was the place to do physics-based game behaviour.

This function is called once per fixed physical time step. This is where the basic physical behavior Code of the game is placed.

Code outside any functionfunction External Code:

Code outside functions is a run when the object is loaded. This can is used to initialise the state of the script.

The code outside the function runs when the object is loaded. This can be used to initialize the state of the script.

Note:sections of this document assume you is using Javascript, but see Writing scripts in C # for information on how T o use C # or Boo scripts.
Note: This document assumes that you are using JavaScript, otherwise see Writing scripts in C # (scripting in C #) to get a script using C # or Boo.

You can also define event handlers. These all has names starting with on, (i.e. oncollisionenter). To see the full list of predefined events, see the documentation formonobehaviour.

You can also use event handlers, whose names begin with on (similar to oncollisionenter), looking at all the predefined list of events and reviewing the document Monobehaviour.

Subsections chapters
  • Common Operations Common operation
  • Keeping track of time record times
  • Accessing other component access to additional components
  • Accessing other game Objects access other gaming objects
  • Vectors Vector
  • Member Variables & Globals Variables member variables & global Variables
  • Instantiate instances
  • Coroutines & Yield co-Program & interrupts
  • Writing Scripts in C # writing scripts with C #
  • The most important classes important class
  • Performance Optimization Performance optimization
  • Script compilation (Advanced) scripting

Unity3d Script Manual

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.