DMG Forge
ArticlesUnity TipsGamesAssets WIPCoursesAbout
ArticlesUnity TipsGamesAssets WIPCoursesAboutFree resources
LV 10 XP
Free resources
Now building:Me and M.A.X

DMG Forge

Unity tips, articles, assets, and devlogs for creators who want to build and finish.

AchievementsSavedSkill treePrivacy

Unity Tips

Jul 25, 2026 · 1 min read · dmg dekels

Control Script Execution Order via Attributes

When system initialization order matters (e.g., global singletons or managers executing before gameplay controllers), standard execution order can lead to race conditions.

#Programming

The Tip: When system initialization order matters (e.g., global singletons or managers executing before gameplay controllers), standard execution order can lead to race conditions.

How to Use: Add [DefaultExecutionOrder(int order)] above class declarations. Negative integers force the script to execute prior to default components (0).

using UnityEngine;

[DefaultExecutionOrder(-100)]
public class GlobalGameManager : MonoBehaviour
{
    private void Awake()
    {
        // Executes prior to default runtime scripts
    }
}

Article complete

XP lands automatically when you reach the end.

Rate this article

Comments

Comments are held for moderation before appearing publicly.

Author

Ddmg dekelsUnity creator & indie dev guide

Related articles

Unity Dev Tools Workflow Templates: Build Faster With Proven PatternsUnity Dev Tools Training and Certification Paths: A Technical Professional's GuideUnity Dev Tools Hiring Guide and Interview Questions: What to Ask and Why It Matters