All Projects → azixMcAze → Unity Executionorder

azixMcAze / Unity Executionorder

Licence: mit
A collection of attributes to control the execution order of your scripts in Unity from your source code.

Projects that are alternatives of or similar to Unity Executionorder

Qframework
Unity3D System Design Architecture
Stars: ✭ 2,326 (+4745.83%)
Mutual labels:  unity, unity3d, unity-scripts
Apple Signin Unity
Unity plugin to support Sign In With Apple Id
Stars: ✭ 228 (+375%)
Mutual labels:  unity, unity3d, unity-scripts
Nvjob Water Shader Simple And Fast
#NVJOB Simple Water Shaders. Free Unity Asset.
Stars: ✭ 172 (+258.33%)
Mutual labels:  unity, unity3d, unity-scripts
Infinity Square Space
Infinity Square/Space. The prototype of the game is open source. Unity Asset.
Stars: ✭ 122 (+154.17%)
Mutual labels:  unity, unity3d, unity-scripts
Restclient
🦄 Simple HTTP and REST client for Unity based on Promises, also supports Callbacks! 🎮
Stars: ✭ 675 (+1306.25%)
Mutual labels:  unity, unity3d, unity-scripts
Unity Curve Utils
A utility that can use 18 kinds of curve algorithm.
Stars: ✭ 151 (+214.58%)
Mutual labels:  unity, unity3d, unity-scripts
Nativecollections
Native Collection Types for Unity
Stars: ✭ 213 (+343.75%)
Mutual labels:  unity, unity3d, unity-scripts
Fancyscrollview
[Unity] A scrollview component that can implement highly flexible animations.
Stars: ✭ 1,216 (+2433.33%)
Mutual labels:  unity, unity3d, unity-scripts
Actors.unity
🚀Actors is a framework empowering developers to make better games faster on Unity.
Stars: ✭ 437 (+810.42%)
Mutual labels:  unity, unity3d, unity-scripts
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+7483.33%)
Mutual labels:  unity, unity3d, unity-scripts
Impulse
A barebones C# bootstrap framework for building scalable projects quickly and easily in Unity.
Stars: ✭ 109 (+127.08%)
Mutual labels:  unity, unity3d, unity-scripts
Savegamepro
A Complete and Powerful Save Game Solution for Unity (Game Engine)
Stars: ✭ 30 (-37.5%)
Mutual labels:  unity, unity3d, unity-scripts
Unitylibrary
📚 Library of all kind of scripts, snippets & shaders for Unity
Stars: ✭ 1,968 (+4000%)
Mutual labels:  unity, unity3d, unity-scripts
Unity Ui Examples
📚 A collection of UI examples for Unity.
Stars: ✭ 152 (+216.67%)
Mutual labels:  unity, unity3d, unity-scripts
Csharp Eval Unity3d
C# Expression Parser for Unity3D
Stars: ✭ 102 (+112.5%)
Mutual labels:  unity, unity3d, unity-scripts
Unitysingleton
The best way to implement singleton pattern in Unity.
Stars: ✭ 185 (+285.42%)
Mutual labels:  unity, unity3d, unity-scripts
Awesome Unity Open Source On Github
A categorized collection of awesome Unity open source on GitHub (800+)
Stars: ✭ 1,124 (+2241.67%)
Mutual labels:  unity, unity3d, unity-scripts
Unity3d Dynamicallyloadinganimation
👾 Unity3D Loading and unloading animations at runtime (Example)
Stars: ✭ 74 (+54.17%)
Mutual labels:  unity, unity3d, unity-scripts
Savegamefree
Save Game Free is a free and simple but powerful solution for saving and loading game data in unity.
Stars: ✭ 279 (+481.25%)
Mutual labels:  unity, unity3d, unity-scripts
Unitynativescripting
Unity Scripting in C++
Stars: ✭ 844 (+1658.33%)
Mutual labels:  unity, unity3d, unity-scripts

Unity Execution Order

A collection of attributes to control the execution order of your scripts in Unity from your source code.

Use

Add one of these attribute to your script's class definition to change its script execution order :

  • [ExecutionOrder(<order>)] : The script execution order is set to order
  • [ExecuteAfter(<type>[, orderIncrease = <increase>])] : The script execution order is set to a value greater than the one of the script type, ensuring that your script will be executed after this script. By default, the script execution order is increased by 10 but this can be changed by adding the orderIncrease argument.
  • [ExecuteBefore(<type>[, orderDecrease = <decrease>])] : Same as ExecuteAfter except that the execution order will be lowered, ensuring that your script will be executed before this script.

A script can have multiple ExecuteAfter attributes and will be executed after all the scripts given in parameters. It is the same for the ExecuteBefore attibutes except it will be executed before all the scripts given in parameters.

A script can only have one type of these attributes and cannot mix the ExecutionOrder, ExecuteAfter and ExecuteBefore attributes.

Changing the execution order of a script with one of these attributes in the Script Execution Order inspector from Unity will have no effect. The order will be reset to the one defined by the attributes.

Changing a script execution order, either from the inspector or with an attribute, will cause a recompilation of the scripts.

Example

// Let's say that this script has an execution order of 50
// set from the Script Execution Order inspector in Unity
public class Script1 : MonoBehaviour {
    void Start () {
        Debug.Log("Second");
    }
}
// this script will have an execution order of 40 (50-10)
[ExecuteBefore(typeof(Script1))]
public class Script2 : MonoBehaviour {
    void Start () {
        Debug.Log("First");
    }
}
// this script will have an execution order of 100
[ExecutionOrder(100)]
public class Script3 : MonoBehaviour {
    void Start () {
        Debug.Log("Third");
    }
}
// this script will have an execution order of 120 (max(40+10, 100+20))
[ExecuteAfter(typeof(Script2)), ExecuteAfter(typeof(Script3), orderIncrease = 20)]
public class Script4 : MonoBehaviour {
    void Start () {
        Debug.Log("Fourth");
    }
}

The resulting script execution orders in the inspector:

Script Execution Order inspector screenshot

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].