• Unity
  • Adding Pre Jumping and Landing Animation to the Code

Hi

I am very new to C# unity and just learnt this amazing software that has so much potential. In the tutorial file from Spine runtimes, Mitch Thompson, one of the forum manager he wrote the Basic Platformer Controller which incredibly helped me and proved it is so useful for the beginners. However, I really wish to add a preparation jumping and landing animation inside the jumping loop. What I mean by that, is

Currently, his code has ability to import walk, run, jump, crouch, fall animation. a jumping loop only go through a sequence from jump to fall animation. I wish to add a pre Jump animation, just 0.08 second before jumping, and landing animation after falling. Is there any suggestion about what should I add to his Code?

The attachment I havent done much at all, tried few time it isnt working. If there is any help would be really really appreciated!!!

Related Discussions
...
  • Modificato

Sorry for the confusion! What you based your code on is quite an old example.
Download the latest unitypackage here (make sure you refresh the page. your browser may have cached an old version): Spine Unity Download

A lot of things were changed in the new example. You may have to start over and re-examine how it was arranged, including the SkeletonDataAsset.
This new sample has a part of the code that shows how animations can be queued based on a transition. (eg, if you're going from "fall" to "run", play the "falling-to-run" animation before starting to play the "run" animation.)

While this new script is better arranged to be more understandable, and so you can rip out or replace the parts that are supposed to be handled better, it is still a simplified sample script. You can learn from it and play with it, but know that in actual production, different concerns like handling animation, effects and physics is typically separated into their own scripts. And individually, there are many ways each component can be written better to be easier to edit and manage.

Thanks Pharah! I will take a look at it and very appreciated for the explaination.


Hey, I just download and update your new example.

But when ever I enter the play mode it says the following msg.

" Assets/Spine/spine-unity/Editor/SpineEditorUtilities.cs(293,33): error CS1501: No overload for method HierarchyIconsOnPlaymodeStateChanged' takes0' arguments "

I have to delete this " SpineEditorHierarchyHandler.HierarchyIconsOnPlaymodeStateChanged(); " in order to work, but in my scene my character will now be invisible until I enter play mode and quickly leave and enter again they will appear.

Thanks for reporting. That should be safe to remove. It's actually not supposed to be there.
Otherwise, it should start working correctly. It doesn't affect anything unless you have the preferences window open.

Note with the new setup, it uses this: PSA: Spine Animations as Unity asset references

Pharan ha scritto

Thanks for reporting. That should be safe to remove. It's actually not supposed to be there.
Otherwise, it should start working correctly. It doesn't affect anything unless you have the preferences window open.

Note with the new setup, it uses this: PSA: Spine Animations as Unity asset references

Thank so much for your help really glad to see this forum is having a such good admin like you.
Here is the thing, I managed add the two animation such as After Falling crouch for walking and idle animation, using the sample code work like a charm.

But whenever I try to add a preparation jumping animation, and trying to use some sort of delay function (like Coroutine: IEnumerator) to stop the jumping animation for a short period of time, after the jump button is pressed, the code just doesn't work and the error says it needs to be C# 7 or above so I reckon it is not good way to go.

For your example jumping code, is there any suggestion solving my case?

Thank you for your time Pharan~