Logo my studio is game, portfólio is developer game

Unity OnEnable and OnDisable

I really like how Unity works the order of execution, see a map of the Order of execution: 

In a project, I needed to know when an object was activated or deactivated, and so do something at that time. 

So the order of execution is so important, because each step has a method hook that works in the corresponding step. 

To know when an object is activated and deactivated we have 2 methods: 

private void OnEnable()
{
  Debug.Log("active...");
}

private void OnDisable()
{
  Debug.Log("Desabled");
}

 

Make contact!

Did you like this content? Let's talk...

I'm a game developer, I use unity. If you want to develop something, tell me!