Skip to content

Instantly share code, notes, and snippets.

@noisecrime
Created November 10, 2016 19:48
Show Gist options
  • Save noisecrime/eeb9093294f1478c6a6c4a819c7b4b9a to your computer and use it in GitHub Desktop.
Save noisecrime/eeb9093294f1478c6a6c4a819c7b4b9a to your computer and use it in GitHub Desktop.
Support Attribute class that works with the editor script 'ScriptExecutionAssignment' to automatically populate the ScriptExecutionOrder.
// ScriptExecutionAttribute
// NoiseCrime
// 10.11.2016
// 05.06.2016
//
// Support Attribute class that works with the editor script 'ScriptExecutionAssignment' to automatically populate the ScriptExecutionOrder.
// Simply add [ScriptExecutionAttribute( value )] prior to your class declaration, where value indicates the script order you want ( -9999 to +9999 )
// This script must NOT be placed in an Editor Folder.
// Example
// using UnityEngine;
//
// [ScriptExecutionAttribute( -9802 )]
// public class ApplicationStartUp : MonoBehaviour
// {
// void Awake()
// {
// ...
// }
// }
using System;
[AttributeUsage( AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public class ScriptExecutionAttribute : Attribute
{
public readonly int executionIndex;
public ScriptExecutionAttribute( int index )
{
this.executionIndex = index;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment