AtticArcade / hotween

Automatically exported from code.google.com/p/hotween
0 stars 0 forks source link

HOTween OnComplete after the object is destroyed #76

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use HOTween.To(...).OnComplete(() =>
2. Before the OnComplete callback, reload the scene
3. Then the callback will execute the code inside the OnComplete(() => but the 
object is destroyed so you will get an error if you try to access any component 
of that GameObject :

MissingReferenceException: The object of type ... has been destroyed but you 
are still trying to access it.

What is the expected output? What do you see instead?
The OnComplete should not be called on a destroyed object.

What version of the product are you using? On what operating system?
HOTween : 1.1.330
Unity : 4.5.0f6
Windows 7

Please provide any additional information below.

I tried to force kill all tweener before reloading the scene with 
HOTween.Kill().

I tried to force completion before reloading the scene with HOTween.Complete().

I tried to kill/complete and reload the scene only the next frame to give time 
for kill/complete to execute.

I looked at the HOTween source code and found that : 
// TODO For now HOTween is NOT destroyed when a scene is loaded, - add option 
to set it as destroyable?

Could that be the problem?

Original issue reported on code.google.com by christia...@illogika.com on 18 Jun 2014 at 6:16

GoogleCodeExporter commented 8 years ago
Hi Christian,

this is weird, I use HOTween.Kill before loading a scene and everything works 
correctly (meaning tweens are killed and callbacks destroyed). Are you using 
HOTween.Init to set HOTween as permanent? If not, could you try it? If you 
still have issues, could you whip up a very simple barebone example and attach 
it, so I can check it out?

Original comment by daniele....@gmail.com on 19 Jun 2014 at 6:38

GoogleCodeExporter commented 8 years ago
Hi,

Using HOTween.Init() fixed my problem!!
Ty!

Original comment by christia...@illogika.com on 19 Jun 2014 at 2:07

GoogleCodeExporter commented 8 years ago

Original comment by daniele....@gmail.com on 20 Jun 2014 at 11:43