Problems with iTween and Instantiating objects

Hi there!

I’m pretty new to Unity (few months) and I’ve been mostly just hacking my project together to try to get it to an MVP status.

When I started my project, i just started spawning everything in the editor and referencing them in script through builtin arrays. Now, I went to clean up some stuff and I started running into all sorts of issues. This started because I changed how I was instantiating/referencing objects from script to now I instantiate the objects on startup vs. in the editor.

Basically, if my objects have iTween.Init(this.gameObject) inside of the Start() functions, I get a ton of the following problems when calling Instantiate on them:

  • My console starts telling me that a lot of objects have NullReferenceExceptions in the RetrieveArgs().
  • After that, it just spews a series of LateUpdate() and TwenUpdate() errors since the id of the object was null in the RetrieveArgs() iTween call… not sure why since the object is valid…

So, I remedied that a little by shoving the iTween.Init call inside of an Initialize function in every object that I want to use. However, during run time, when I go to Destroy/Instantiate another object, I get problems…

My questions are as follows:

  • Should I just go back and keep things using builtin arrays and not do any instantiating/creation during run time? Although before was more efficient, I’m just trying to know what it’s considered as “clean” by Unity standards…
  • Should objects that use iTween be mutually exclusive to objects that are created by using the Instantiate() method?
  • Could someone perhaps provide me an answer about what’s going on behind the scenes with iTween and the Instantiate() method?


I know this comes a few years late but I had the same issues and the NullReferenceExceptions only went away when I called


from within Awake() inside a script that is bound to a PreFab.

For anyone stumbling upon this issue, it might come in handy…

I had the same issues as you.

I was following the docs/tutorials that mention that you should link a Prefab to a script by giving it a type of “Transform” in the script. When I changed it to a GameObject, I was able to use iTween with Instantiated prefabs.

I had the same TetrieveArgs() exception, but that was due to my accidentally Instantiating an object twice. I Instantiated, then executed the iTween command,and later in my script I was Instantiating and assigning to the same object. I fixed this by removing the 2nd one.