Huy Minh Ha

Software development, Tech and other stuff



Fri 28 October 2016

When to use Script Execution Order

Posted by Ha.Minh in Unity   

Normally we don't control the execution order of MonoBehaviour scripts, and we should not. However, there are cases where we do want some scripts to be executed before others. Some usecases include:

  1. A Controller script that should be executed as the entry point to the scene
  2. Scripts which use ...

Read more...


Fri 28 October 2016

Run specific code when Editor starts

Posted by Ha.Minh in Unity   

Sometimes we want to execute code whenever we hit Play button in Unity Editor. The reason for this usually is that we want to enforce some workflow automatically such as getting specific environment information (e.g. git hash, date) and fill it in a prefab or something. We could do ...

Read more...



Thu 29 September 2016

Unity singleton

Posted by Ha.Minh in Unity   

First of all, please remember that Singletons are generally not recommended due to various obvious disadvantages:

  • Hard to reason about code
  • Encourage coupling
  • Potential concurrency issue

However, in game development it's super useful to have singleton for many types of global system, including but not limited to:

  • Sound system ...

Read more...