How to skip the Start and Awake calls on a freshly instantiated object?

Is there a way to skip/ignore the Start and/or Awake calls on a freshly instantiated object?

I know I could just simply not use Start/Awake at all and create an own function to call manually, but I am currently working on a generic Object Pool class hat is supposed to work with arbitrary Objects, so that is not the most desirable option.

You can not call Start() by disabling the object after instantiation or even before (disabling the gameObject you instantiate, if you do it by copying). But AFAIK Awake is called immediately after the component is constructed. But from how i understand unity messages and how they were meant to be used, it should be OK (for correctly implemented scripts) to Only have Awake and Start called once, and rely on OnEnable and OnDisable for the reuse purposes… but I understand that this won’t be the case in 95% scripts. And many scripts may not handle it correctly, when Start or Awake are called multiple times on the same script, so no generic solution would be acceptable here anyway. I know you asked a specific question which i cannot answer positively… So your options are:

  • Rewrite scripts you want to pool, or make sure they do the necessary initialization in OnEnable and OnDisable
  • Don’t use GO Pooling. Is object instantiating itself (not object initialization in Start/Awake) really your bottleneck? It’s very unlikely. Check again.

I also had this need.

I solved it by disabling the script on the prefab (myScript.enabled = false) one line before instantiation and re-enabling it when I really needed to execute the Awake (in my case I had to wait for the data to be loaded from the save before executing the Awake).