khangnhfuky / hotween

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

Crashes unity when using HOTween with incorrect usage #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I did this trying to tween a Rect.

For the game object I put a variable holding the Rect.
For the property I put one of the Rect properties.

var myRect :Rect = Rect(0,0,0,0);

HOTween.To(myRect, 1, "x", 300);

This code crashes unity instead of throwing an error.

Original issue reported on code.google.com by Grimshad on 9 May 2013 at 10:47

GoogleCodeExporter commented 9 years ago
I tried to replicate it, and it correctly throws an error without crashing 
Unity. Sometimes Unity gets randomly crazy, so I suppose the crash might not be 
considered as related to HOTween

Original comment by daniele....@gmail.com on 10 May 2013 at 8:32

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I would like to add that it crashed every single time I run the game in editor 
as soon as I call the tween. Unity has never crashed for me before this 
occurrence. If it's just me, then I don't know what's wrong  :/

Original comment by Grimshad on 10 May 2013 at 8:59

GoogleCodeExporter commented 9 years ago
Sometimes Unity can become unstable and start crashing very easily, so it might 
be that. A thing that comes to my mind, is that the error is thrown every 
frame, so the Editor Console is put under stress. That shouldn't be a problem 
at all, but if Unity became unstable for other reasons it might lead to a 
crash. What Unity version are you using? On what OS?

Also, I forgot to mention: I suppose you know that that code is wrong, right? 
"myRect" should be public and used as the property instead of "x" (because 
Unity treats Rects as structs, so an X value can't be directly animated). So it 
should be:
HOTween.To(this, 1, "myRect", new Rect(300,0,0,0));

Original comment by daniele....@gmail.com on 10 May 2013 at 9:15

GoogleCodeExporter commented 9 years ago
I'm running the latest version of Unity (4.1.2f2) on Windows 8. Yes, I know the 
code is wrong. I discovered this crash during my trial and error phase of 
learning HOTween. This may not be the place for it, but I don't know where is 
so, while I'm here I mine as well throw you some feedback for that on things 
that caught me up:

1. On this page: http://www.holoville.com/hotween/documentation.html#hotweeninit

for the init, you never mention that you have to import HOTween before it will 
work. I had to find it on a completely separate page of your site:
http://www.holoville.com/hotween/getStarted.html

2. I never saw anything mention that struct members can't be used, that tripped 
me up for a while until I decided to just write out the whole thing.

3. In your examples of Ease Types it mentions to get a list of ease types 
available refer to the API, but doesn't link to the API. I'm sure everyone 
would appreciate a direct link for that: 
http://www.holoville.com/hotween/hotweenAPI/namespace_holoville_1_1_h_o_tween.ht
ml#ab8f6c428f087160deca07d7d402c4934

4. To prevent having to create 2 Tweeners to play an animation forward and 
backwards, I attempted to use Play() to play it forward and PlayBackwards() to 
play it backwards. Even though the Tweener is set to not autokill, after using 
the Play() function, the Tweener can no longer been called Forward or 
backwards. Like it's a one shot animation even though it still exists.

I ended up solving this by never calling Play() and only calling PlayForward() 
and PlayBackwards(). This makes sense, but no one would assume Play() works 
this way at a glance.

Original comment by Grimshad on 10 May 2013 at 2:17

GoogleCodeExporter commented 9 years ago
Thanks for the feedback :)

You're right about the first 2 points. I assumed both of them would be obvious 
for coders, but I realize they're not. I also realized that especially the 
second one is not obvious at all for UnityScript users, since US "hides" the 
fact that struct properties can't be changed directly (when you do
myTransform.position.x = N,
US does this in the background:
myTransform.position = new Vector3(N, myTransform.position.y, 
myTransform.position.z)

You're right again about point 3 too: just added a link in the documentation 
page.

I'll see to make the Play documentation more clear instead :)

Original comment by daniele....@gmail.com on 10 May 2013 at 4:02