iTween causes NullReferenceException

I have few scripts with iTween based actions, but iTween started to cause NullReferenceException if I update code during playmode.

The error comes if I enter playmode and then make modifications to any script (even one, where there are no iTween actions). I get the following error when Unity refreshes the script automatically:

NullReferenceException: Object reference not set to an instance of an object
iTween.TweenUpdate () (at Assets/Standard Assets/iTween/Plugins/iTween.cs:4624)
iTween.Update () (at Assets/Standard Assets/iTween/Plugins/iTween.cs:6563)

Any ideas of what is causing this? Or how I could get rid of it?

Ps. I don’t know if it matters, but iTween is placed in Standard Assets/iTween/Plugins -folder.

I have the same in many (most/all) cases. Simple solution: Don’t edit scripts in play mode.

That’s what I’ve been doing, but it produces stupid problems.

I move an object 1 unit with iTween and then I go to play mode and see what it looks like. “Oh, it’s not enough”
I stop play mode, make the movement 2 units and enter the play mode again. “Now it’s too much”
I stop play mode again, alter movement to 1.5 units…

iTween is an excellent tool, if it wouldn’t make that error. I could make my movements and/or rotations usually with Mathf.Lerp, but iTween would make all that so much easier.

Just to be more specific, I was not talking about iTween only, but instead I also saw that a lot with self built scripts. Seems like one can never tell if a script change during runtime will actually work, that’s why I don’t do that anymore and always restart the scene when I need to test a change. It’s a bit of a hassle as you mentioned, but that way I am 100% sure that the errors occuring are caused by myself and not a hiccup during script compilation. :wink:

Ah, yes. I do only small changes like the ones I mentioned during play mode.
Bigger ones I always test with a restart.

But the fact that iTween gives the error means there is a problem with it. There shouldn’t be an error.
Or am I doing something wrong with it?

I’m with Qualdan - I would love to see this resolved. Making small incremental changes to some small bit of code somewhere shouldn’t necessitate a complete restart due to iTween behaving poorly.

Has anyone gotten anywhere with this?

I think the statement of “iTween behaving poorly” can be negated by the fact that it is just bad practice to edit gameplay scripts while running the scene; you should expect errors to be thrown if you are changing a script during runtime. If the need to tweak the values during play mode is that high, expose some members to the inspector and update from there.