1. sayfa (Toplam 1 sayfa)
rautatrukki
In unity how I can activate function when Spine animation ends?
9.5 years ago
- rautatrukki
- Mesajlar: 5
Nate
Once event timeline is done you can use that. Until then you can use the AnimationState time or AnimationState isCompleted.
9.5 years ago
-
Nate - Mesajlar: 12213
rautatrukki
Is there a option to ask what animation is now playing?
example:
if(animationplayingname == "attack" && skeletonAnimation.state.Time <= 0) {
dosomething();
}
Or is there a better way to do this?
Thanks!
Edit: I found it! skeletonAnimation.state.Animation.Name
Thanks for help Nate and for fast answers!
example:
if(animationplayingname == "attack" && skeletonAnimation.state.Time <= 0) {
dosomething();
}
Or is there a better way to do this?
Thanks!

Edit: I found it! skeletonAnimation.state.Animation.Name
Thanks for help Nate and for fast answers!

9.5 years ago
- rautatrukki
- Mesajlar: 5
Nate
Bingo! 

9.5 years ago
-
Nate - Mesajlar: 12213
Pharan
As a sidebar, Nate:
For checking the current animation of an AnimationState, particularly in C#/Java;
What do you think of:
(a) using a string compare (by checking if AnimationState.Animation.Name == "animationname")
vs.
(b) using a reference compare (by checking if AnimationState.Animation == a cached Spine.Animation reference, probably preloaded at initialization with SkeletonData.FindAnimation("animationname") )
?
Really not a point of concern? Any design considerations?
For checking the current animation of an AnimationState, particularly in C#/Java;
What do you think of:
(a) using a string compare (by checking if AnimationState.Animation.Name == "animationname")
vs.
(b) using a reference compare (by checking if AnimationState.Animation == a cached Spine.Animation reference, probably preloaded at initialization with SkeletonData.FindAnimation("animationname") )
?
Really not a point of concern? Any design considerations?
Spine-Unity Docs Repo, and check out the Unofficial Spine Users Tumblr.
9.5 years ago
-
Pharan - Mesajlar: 5366
Nate
A single string comparison is (generally) fine. Many string comparisons isn't so great. The reference comparison is obviously more efficient, but unless the difference actually affects the application user (and it most likely doesn't) then fretting over the difference is a misuse of your time. 

9.5 years ago
-
Nate - Mesajlar: 12213
Mark topic unread
• 1. sayfa (Toplam 1 sayfa)
Dön Runtimes
- Tüm zamanlar UTC