{"id":14960899,"url":"https://github.com/azixmcaze/unity-executionorder","last_synced_at":"2025-07-03T12:03:26.434Z","repository":{"id":147177069,"uuid":"106954062","full_name":"azixMcAze/Unity-ExecutionOrder","owner":"azixMcAze","description":"A collection of attributes to control the execution order of your scripts in Unity from your source code.","archived":false,"fork":false,"pushed_at":"2017-11-18T18:29:10.000Z","size":63,"stargazers_count":78,"open_issues_count":0,"forks_count":15,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-15T22:23:07.527Z","etag":null,"topics":["execution-graph","unity","unity-scripts","unity3d"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/azixMcAze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2017-10-14T18:51:21.000Z","updated_at":"2025-05-28T23:21:27.000Z","dependencies_parsed_at":"2024-02-01T15:27:44.156Z","dependency_job_id":"e684cf1e-46af-42cb-92e5-f47738e208c2","html_url":"https://github.com/azixMcAze/Unity-ExecutionOrder","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/azixMcAze/Unity-ExecutionOrder","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azixMcAze%2FUnity-ExecutionOrder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azixMcAze%2FUnity-ExecutionOrder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azixMcAze%2FUnity-ExecutionOrder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azixMcAze%2FUnity-ExecutionOrder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/azixMcAze","download_url":"https://codeload.github.com/azixMcAze/Unity-ExecutionOrder/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/azixMcAze%2FUnity-ExecutionOrder/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263322786,"owners_count":23448712,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["execution-graph","unity","unity-scripts","unity3d"],"created_at":"2024-09-24T13:23:23.733Z","updated_at":"2025-07-03T12:03:26.405Z","avatar_url":"https://github.com/azixMcAze.png","language":"C#","readme":"# Unity Execution Order\n\nA collection of attributes to control the execution order of your scripts in Unity from your source code.\n\n## Use\nAdd one of these attribute to your script's class definition to change its script execution order :\n- `[ExecutionOrder(\u003corder\u003e)]` : The script execution order is set to `order`\n- `[ExecuteAfter(\u003ctype\u003e[, orderIncrease = \u003cincrease\u003e])]` : 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.\n- `[ExecuteBefore(\u003ctype\u003e[, orderDecrease = \u003cdecrease\u003e])]` : Same as `ExecuteAfter` except that the execution order will be lowered, ensuring that your script will be executed before this script.\n\nA 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.\n\nA script can only have one type of these attributes and cannot mix the `ExecutionOrder`, `ExecuteAfter` and `ExecuteBefore` attributes.\n\nChanging 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.\n\nChanging a script execution order, either from the inspector or with an attribute, will cause a recompilation of the scripts.\n\n## Example\n```csharp\n// Let's say that this script has an execution order of 50\n// set from the Script Execution Order inspector in Unity\npublic class Script1 : MonoBehaviour {\n    void Start () {\n        Debug.Log(\"Second\");\n    }\n}\n```\n```csharp\n// this script will have an execution order of 40 (50-10)\n[ExecuteBefore(typeof(Script1))]\npublic class Script2 : MonoBehaviour {\n    void Start () {\n        Debug.Log(\"First\");\n    }\n}\n```\n```csharp\n// this script will have an execution order of 100\n[ExecutionOrder(100)]\npublic class Script3 : MonoBehaviour {\n    void Start () {\n        Debug.Log(\"Third\");\n    }\n}\n```\n```csharp\n// this script will have an execution order of 120 (max(40+10, 100+20))\n[ExecuteAfter(typeof(Script2)), ExecuteAfter(typeof(Script3), orderIncrease = 20)]\npublic class Script4 : MonoBehaviour {\n    void Start () {\n        Debug.Log(\"Fourth\");\n    }\n}\n```\nThe resulting script execution orders in the inspector:\n\n![Script Execution Order inspector screenshot](/docs/screenshot1.png)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazixmcaze%2Funity-executionorder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fazixmcaze%2Funity-executionorder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fazixmcaze%2Funity-executionorder/lists"}