<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq" -->

---
title: This ONE simple rule helps avoid so many Unity issues!
description: A practical rule for Unity development: use Awake() for local initialization and Start() for accessing external references. This ordering guarantee (Awake...
canonical: https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: This ONE simple rule helps avoid so many Unity issues! | daily.dev
og:description: A practical rule for Unity development: use Awake() for local initialization and Start() for accessing external references. This ordering guarantee (Awake...
og:url: https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq
og:image: https://api.daily.dev/og/posts/cf9wvZMOQ.png
og:image:alt: This ONE simple rule helps avoid so many Unity issues!
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# This ONE simple rule helps avoid so many Unity issues!

**[Code Monkey](https://daily.dev/sources/codemonkeyunity)** · 1 min read · 0 upvotes · 0 comments

## Summary

A practical rule for Unity development: use Awake() for local initialization and Start() for accessing external references. This ordering guarantee (Awake always runs before Start across all scripts) prevents common null reference exceptions, especially in patterns like singletons where one object's Start() depends on another object's instance being set. Following this rule makes script execution order-independent and eliminates a class of intermittent, machine-dependent bugs.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://www.youtube.com/watch?v=dzXDJOX_kpM>

## Questions this post answers

### why does my Unity singleton sometimes throw a null reference exception when another script accesses it

It happens because Unity does not guarantee execution order between different scripts' Start methods, so a script accessing another object's singleton instance in Start might run before that instance is set. The fix is to set the singleton instance in Awake instead of Start, since Unity always runs Awake on every active object before any Start runs, guaranteeing the instance exists.

_Developers debugging Unity timing issues can find script lifecycle explanations like this on daily.dev._

### should I use Awake or Start to initialize a singleton instance in Unity

Set the singleton instance in Awake, not Start. Awake is meant for local initialization of the current object, while Start should be used only for accessing external references on other objects. Because Unity runs Awake on all objects before any Start call, this ordering guarantees the singleton is ready whenever another script's Start tries to read it.

_daily.dev surfaces practical Unity patterns for developers deciding how to structure singleton initialization._

## Similar posts on daily.dev

- [How to Build Reusable Modular Unity Packages to Speed Up Development](https://daily.dev/posts/how-to-build-reusable-modular-unity-packages-to-speed-up-development-qqjeobr8o) · freeCodeCamp · 3 upvotes · 0 comments

---

Tags: [#game-development](https://daily.dev/tags/game-development), [#c#](https://daily.dev/tags/c#), [#unity](https://daily.dev/tags/unity)

[View this post on daily.dev](https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"This ONE simple rule helps avoid so many Unity issues!","url":"https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq"},"datePublished":"2026-09-05T14:19:46.189Z","dateModified":"2026-09-14T07:09:28.533Z","description":"A practical rule for Unity development: use Awake() for local initialization and Start() for accessing external references. This ordering guarantee (Awake...","image":"https://i.ytimg.com/vi/dzXDJOX_kpM/sddefault.jpg","thumbnailUrl":"https://i.ytimg.com/vi/dzXDJOX_kpM/sddefault.jpg","isAccessibleForFree":true,"articleSection":"Code Monkey","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Code Monkey","logo":"https://media.daily.dev/image/upload/s--mgoqDIgw--/f_auto/v1727446687/logos/codemonkeyunity","url":"https://daily.dev/sources/codemonkeyunity"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"game-development,c#,unity","timeRequired":"PT1M","video":{"@type":"VideoObject","name":"This ONE simple rule helps avoid so many Unity issues!","description":"A practical rule for Unity development: use Awake() for local initialization and Start() for accessing external references. This ordering guarantee (Awake...","thumbnailUrl":"https://i.ytimg.com/vi/dzXDJOX_kpM/sddefault.jpg","uploadDate":"2026-09-05T14:19:46.189Z","duration":"PT1M","url":"https://api.daily.dev/r/cf9wvZMOQ","embedUrl":"https://www.youtube.com/embed/dzXDJOX_kpM"}}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Code Monkey","item":"https://daily.dev/sources/codemonkeyunity"},{"@type":"ListItem","position":3,"name":"This ONE simple rule helps avoid so many Unity issues!"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/this-one-simple-rule-helps-avoid-so-many-unity-issues--cf9wvzmoq#faq","mainEntity":[{"@type":"Question","name":"why does my Unity singleton sometimes throw a null reference exception when another script accesses it","acceptedAnswer":{"@type":"Answer","text":"It happens because Unity does not guarantee execution order between different scripts' Start methods, so a script accessing another object's singleton instance in Start might run before that instance is set. The fix is to set the singleton instance in Awake instead of Start, since Unity always runs Awake on every active object before any Start runs, guaranteeing the instance exists. Developers debugging Unity timing issues can find script lifecycle explanations like this on daily.dev."}},{"@type":"Question","name":"should I use Awake or Start to initialize a singleton instance in Unity","acceptedAnswer":{"@type":"Answer","text":"Set the singleton instance in Awake, not Start. Awake is meant for local initialization of the current object, while Start should be used only for accessing external references on other objects. Because Unity runs Awake on all objects before any Start call, this ordering guarantees the singleton is ready whenever another script's Start tries to read it. daily.dev surfaces practical Unity patterns for developers deciding how to structure singleton initialization."}}]}
```

