FashGek / hotween

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

In Editor when stoping play of game, HOTween will leave tween objects in my scene #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.Unity4
2.Combination of doing tweens and killing them possibly ?
3.

What is the expected output? What do you see instead?
I expect HOTween to not leave stuff in my scene after hitting stop

What version of the product are you using? On what operating system?
Windows 7 64 bit , Unity 4.0.0f7 , HOTween 1.1.724

Please provide any additional information below.

objects left are named in this pattern:  HOTween : 1  ( they have a HOTween 
script component that says No tweens. 

These errors from log at stop time might be helpful:

IsPlayingOrAllowExecuteInEditMode ()

(Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/Mono/MonoBehaviour.cpp 
Line: 587)

Destroy may not be called from edit mode! Use DestroyImmediate instead.
Also think twice if you really want to destroy something in edit mode. Since 
this will destroy objects permanently.
UnityEngine.Object:Destroy(Object, Single)
UnityEngine.Object:Destroy(Object) (at 
C:\BuildAgent\work\812c4f5049264fad\Runtime\ExportGenerated\Editor\UnityEngineOb
ject.cs:78)
Holoville.HOTween.HOTween:Clear()
Holoville.HOTween.HOTween:CheckClear()
Holoville.HOTween.HOTween:Update()

Original issue reported on code.google.com by invadere...@gmail.com on 11 Jan 2013 at 7:59

GoogleCodeExporter commented 9 years ago
Mhmm Unity 4 seems to have introduced a messy garbage collection when stopping 
a game in the Editor. I had the same issue with other stuff, though not with 
HOTween. I think I know how to solve it, and should fix it quite quickly.

Original comment by daniele....@gmail.com on 11 Jan 2013 at 8:55

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
( I deleted the last comment ) I did just get the same error even after copying 
the files on this website. 

Original comment by invadere...@gmail.com on 11 Jan 2013 at 10:23

GoogleCodeExporter commented 9 years ago
It actually seems to be a bug in Unity 4. But I made some changes that should 
solve it. Can you check if the attached version (1.1.725) fixes it, since I 
can't reproduce it?

Original comment by daniele....@gmail.com on 12 Jan 2013 at 11:54

Attachments:

GoogleCodeExporter commented 9 years ago
I still have the same problem, here is the error log: 

!IsPlayingOrAllowExecuteInEditMode ()

(Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/Mono/MonoBehaviour.cpp 
Line: 587)

Destroy may not be called from edit mode! Use DestroyImmediate instead.
Also think twice if you really want to destroy something in edit mode. Since 
this will destroy objects permanently.
UnityEngine.Object:Destroy(Object, Single)
UnityEngine.Object:Destroy(Object) (at 
C:\BuildAgent\work\812c4f5049264fad\Runtime\ExportGenerated\Editor\UnityEngineOb
ject.cs:78)
Holoville.HOTween.HOTween:Clear()
Holoville.HOTween.HOTween:CheckClear()
Holoville.HOTween.HOTween:Update()

[C:/BuildAgent/work/812c4f5049264fad/Runtime/Scripting/ScriptingUtility.cpp 
line 344] 
(Filename: 
C:/BuildAgent/work/812c4f5049264fad/Runtime/ExportGenerated/Editor/UnityEngineOb
ject.cs Line: 78)

!IsPlayingOrAllowExecuteInEditMode ()

(Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/Mono/MonoBehaviour.cpp 
Line: 587)

Original comment by invadere...@gmail.com on 14 Jan 2013 at 6:57

GoogleCodeExporter commented 9 years ago
Ouch! Have you tried with the newly released Unity 4.0.1 which fixes some bugs?

Original comment by daniele....@gmail.com on 14 Jan 2013 at 7:03

GoogleCodeExporter commented 9 years ago
I wasn't even aware of 4.0.1, let me download that, get back to you in a few 
minutes

Original comment by invadere...@gmail.com on 14 Jan 2013 at 7:07

GoogleCodeExporter commented 9 years ago
Nope same problem, is there any other info I could provide you to help solve 
the problem ? 

Original comment by invadere...@gmail.com on 14 Jan 2013 at 7:39

GoogleCodeExporter commented 9 years ago
It's weird, with the new internal callback I added, using OnApplicationQuit, 
Update shouldn't be called since HOTween should get cleared already.

If you could create a sample project that replicates the issue it would be 
awesome! I can't seem to do that from here. If you can't, let me know, and I'll 
try something else.

Original comment by daniele....@gmail.com on 14 Jan 2013 at 8:24

GoogleCodeExporter commented 9 years ago

Original comment by daniele....@gmail.com on 14 Jan 2013 at 8:24

GoogleCodeExporter commented 9 years ago
I'm having trouble reproducing the bug in a simpler separate test scene and I 
cant send the bigger project since it belongs to the company I work for.  

Original comment by invadere...@gmail.com on 14 Jan 2013 at 10:05

GoogleCodeExporter commented 9 years ago
Don't worry I'll try some test build to find a solution. Only thing: won't be 
able to put my hands on it until Wednesday, since tomorrow I have a hell of a 
day :P

Original comment by daniele....@gmail.com on 14 Jan 2013 at 10:51

GoogleCodeExporter commented 9 years ago
A small detail I just noticed if I set HOTween.Init( true); 
at the start of the app I get these left over in my scene
HOTween : 0
instead of
HOTween : 1 

thanks for the support.

Original comment by invadere...@gmail.com on 15 Jan 2013 at 12:53

GoogleCodeExporter commented 9 years ago
also I dont get the Destroy message in the log, just the other two :

!IsPlayingOrAllowExecuteInEditMode ()

(Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/Mono/MonoBehaviour.cpp 
Line: 587)

Some objects were not cleaned up when closing the scene

(Filename: 
C:/BuildAgent/work/812c4f5049264fad/Runtime/Misc/SaveAndLoadHelper.cpp Line: 
192)

Original comment by invadere...@gmail.com on 15 Jan 2013 at 12:59

GoogleCodeExporter commented 9 years ago
Interesting, thanks. That should definitely help me to isolate the problem.

Original comment by daniele....@gmail.com on 15 Jan 2013 at 1:01

GoogleCodeExporter commented 9 years ago
I tried following the suggestion here:  
http://forum.unity3d.com/threads/124054-OnDestroy()-problem-on-Pickups

by adding:
if (tweenGOInstance != null && !isShuttingDown)
to line 2084 of HOTween.cs 

and

        static bool isShuttingDown = false;
        void OnApplicationQuit()
        {
            isShuttingDown = true;
        }

This seems to make the bug happen less often, but still happens...  ( let me 
know if I should stop posting these and just wait till Wednesday ) . 

Original comment by invadere...@gmail.com on 15 Jan 2013 at 1:16

GoogleCodeExporter commented 9 years ago
Last thing I noticed (after changes above):

In my scene one of the first things that happen is that I have an alpha fade 
and a music fade in, I use the tweens for those two and I get a Hotween : 2 , 
most times if I quit the app when I can see the Hotween : 2, then the app will 
end with out errors. If I wait for both tweens to be over, and then I quit the 
app I can reproduce the error almost every time. 

I assume that after the tweens are gone, there shouldnt really be anything to 
erase, so dont understand why I suddenly would get a new tween Hotween : 1 at 
that point that attempts to get erased then in edit mode. 

Anyway, hopefully you can find something on wednesday. 

Original comment by invadere...@gmail.com on 15 Jan 2013 at 3:07

GoogleCodeExporter commented 9 years ago
Last thing I noticed (after changes above):

In my scene one of the first things that happen is that I have an alpha fade 
and a music fade in, I use the tweens for those two and I get a Hotween : 2 , 
most times if I quit the app when I can see the Hotween : 2, then the app will 
end with out errors. If I wait for both tweens to be over, and then I quit the 
app I can reproduce the error almost every time. 

I assume that after the tweens are gone, there shouldnt really be anything to 
erase, so dont understand why I suddenly would get a new tween instance Hotween 
: 1 at that point that attempts to get erased then in edit mode. 

Anyway, hopefully you can find something on wednesday. 

Original comment by invadere...@gmail.com on 15 Jan 2013 at 3:08

GoogleCodeExporter commented 9 years ago
I *think* this version 1.1.726 should solve the issue. I used the suggestion 
you implemented (though calling the property "quitting" instead than 
"shuttingDown"), but while having it still clean everything up. If this doesn't 
work, I have another idea of how to solve it, but I hope there won't be need 
for it.
Let me know.

Original comment by daniele....@gmail.com on 16 Jan 2013 at 4:08

Attachments:

GoogleCodeExporter commented 9 years ago
hmmm I didnt get an email for that last comment = ( 

I still get the error below and the leftover gameobject:

Some objects were not cleaned up when closing the scene

(Filename: 
C:/BuildAgent/work/812c4f5049264fad/Runtime/Misc/SaveAndLoadHelper.cpp Line: 
192)

Original comment by invadere...@gmail.com on 21 Jan 2013 at 10:33

GoogleCodeExporter commented 9 years ago
Ouch, damn mails :(

Anyway, here is another version with a different type of check. If this doesn't 
work, it means I'm looking at the problem from a totally wrong side.

Let me know :)

Original comment by daniele....@gmail.com on 22 Jan 2013 at 11:03

Attachments:

GoogleCodeExporter commented 9 years ago
So works a little bit better, like I mentioned in the comment #18 above if 
there are tweens running and I stop the app then no error, if there are no 
tweens running and I stop the app I get the same error.

Original comment by invadere...@gmail.com on 23 Jan 2013 at 7:06

GoogleCodeExporter commented 9 years ago
= / I really don't seem to get this problem with other tweens in the app except 
the ones associated with sound, maybe I'm just doing something stupid, I'm 
going to attach my "SoundManager" class here, maybe take a look see if I'm 
doing something wrong here.

Original comment by invadere...@gmail.com on 23 Jan 2013 at 7:16

Attachments:

GoogleCodeExporter commented 9 years ago
Hey, sorry if this took me a while.

I'm attaching a beta version with another mod. In case that doesn't work, could 
you try these different initialization approaches and tell me again the errors 
you have with each one (or if some of those approaches solve it)?
1) HOTween.Init(false,false,false);
1) HOTween.Init(true,true,false);
1) HOTween.Init(true,false,false);

I also went through your SoundManager class, but it seems everything's ok there.

Original comment by daniele....@gmail.com on 30 Jan 2013 at 10:41

Attachments:

GoogleCodeExporter commented 9 years ago
730b with no Init behaves same as #22

Init(false,false,false) = same as #22 only difference is the leftover object 
just says "Hotween" with no extra number

Init(true,true,false) = Yay! this seems to work, I notice that Hotween: 0 stays 
around preventing the possible fail scenario ? 

Init(true,false,false) = this seems to work too, I notice that Hotween stays 
around
like above.

Thank you for taking the time to address this issue ! = ] 

Original comment by ebe...@thirdmotion.com on 30 Jan 2013 at 7:01

GoogleCodeExporter commented 9 years ago
Very interesting: so Unity has issues when destroying HOTween while the Editor 
player is closing. I should now be able to make a version which will work 
regardless of the Init settings - though setting the first Init parameter to 
true is the best thing to do for performance anyway ;)

Original comment by daniele....@gmail.com on 6 Feb 2013 at 6:01

GoogleCodeExporter commented 9 years ago
Back! Could you try the attached version 1.1.731, to see if it solves the bug 
with Unity 4 completely? Try to set Init(false,false,false), and see what 
happens: everything should hopefully work now.

Thanks :)

Original comment by daniele....@gmail.com on 6 Feb 2013 at 6:09

Attachments:

GoogleCodeExporter commented 9 years ago
still broken using Init(false,false,false) on 731

Original comment by invadere...@gmail.com on 6 Feb 2013 at 6:56

GoogleCodeExporter commented 9 years ago
actually 731 is worst than 730b, Init(true,true,false) doesn't work

Original comment by ebe...@thirdmotion.com on 20 Feb 2013 at 12:46

GoogleCodeExporter commented 9 years ago
Sorry if I'm being superlate, but these days are supermessy, and I'm taking 
advantage of the fact that at least we know how to avoid the issue.

Thanks for the additional info. I hope to have time to try something else to 
fix it permanently at the beginning of next week.

Original comment by daniele....@gmail.com on 20 Feb 2013 at 11:43

GoogleCodeExporter commented 9 years ago
Finally made some more changes. Could you check if
Init(true,true,false)
Init(true,false,false)
are working with this version? I don't care about Init(false...) because it's 
just a waste of resources to set it to false, so next version won't allow it 
(but will still keep that overload to avoid breaking older projects).

Thanks :)

Original comment by daniele....@gmail.com on 23 Feb 2013 at 12:44

Attachments:

GoogleCodeExporter commented 9 years ago
tried both: 
Init(true,true,false)
Init(true,false,false)

they both have the same problems :

!IsPlayingOrAllowExecuteInEditMode ()

(Filename: C:/BuildAgent/work/812c4f5049264fad/Runtime/Mono/MonoBehaviour.cpp 
Line: 587)

they leave the usual HOTween laying around... 730b is still the winner.

Sorry for not getting back, now that it works (730b) I forget to check here.

Original comment by invadere...@gmail.com on 14 Mar 2013 at 6:50

GoogleCodeExporter commented 9 years ago

Original comment by daniele....@gmail.com on 11 Dec 2013 at 12:18