Author Topic: TNObject registration  (Read 1993 times)

ScaryG

  • Guest
TNObject registration
« on: April 01, 2013, 04:32:33 PM »
Is there any reason TNObjects don't call Register() (which assigns them a unique ID) until the Start function? It would be convenient if they registered themselves from Awake so that if I wanted to cache the ID for whatever reason, I could do that in my own component's Start without needing to mess with script execution orders.

I tried calling it myself from TNObject.Awake() and things seemed to work fine, but I thought I should check if there was a reason you're waiting for Start :)

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: TNObject registration
« Reply #1 on: April 01, 2013, 10:47:57 PM »
Because the UID can change after Awake() and before Start().

TNManager instantiates an object, its Awake() gets called, then TNManager sets its ID. If you register it in Awake(), then it won't be using the proper ID.