animations on scriptableobject

my game is rpg one. so i have alot of animation for all the characters.

so my idea is to create animations with the animation tool and insert them in scriptableobject of each character/ skill.

is there a way to put animations inside scriptableobj? and use it later when i set the scriptobj inside gameobject with animator?

example for a game with kind of similar way to my is pokemon.
each pokemon have attack, sp.attack animations and each move got one too.

im new to the engine and the scripting part so few keywords /functions will be very helpful.
also if there any other ideas to make it work…

animations are triggered via Animator through state variables which have string identifiers.

you can map these string identifiers inside scriptableobjects to correlate with certain actions, then make a function that takes these and triggers Animator accordingly.

Animator uses state diagrams to interconnect individual keyframe animations. these state diagrams are in their own separate files.

I’m certain someone has already made something similar to want you want, in some capacity.
What I mean is that I personally can’t help you more than just explaining the systems and how they work.

i think i get how the animator work in general.
rn if i just use the strings states it will make my diagram very big (i will have to insert all the animations and give each a state). at least this is how i undestand it.

i want to create the diagram in the scene, and insert the animations in separate at the start.

At this point I can’t really understand you.

maybe i ask this. how large games with alot of characters/ animations work? how they load or store all the characters?

btw there is animations class “Animation”.
i dont know how to use it though.

Another idea would be that you don’t store the animation directly into the ScriptableObject but their String name.
You could then store your animation in the resources folder and load them based on the name when you need them.

Let me suggest you get 100% familiar with the recommended way of doing animations and managing assets in Unity before you go inventing your own notion of how it should be done.

Do the simplest approach first, if it begins to have difficulty scaling up, refactor and implement a management layer to help you.

Making the management layer(s) in advance, especially before you are even versant in the basics of Unity asset management, is guaranteed to fail in spectacular time-wasting fashion.

But of course, it is your time to waste. I recommend starting by working your way through a MINIMUM OF THREE different tutorials on animation, all from different people, to get a feel for how things work.

2 Likes

Maybe you want to put animation clips inside the scriptable object.

You can check AnimationOverrideController.
you can have a single animator with some default animation clips like idle, walk ,run.

Then create AnimationOverrideController for each characters. drag and drop the original animator into this component’s controller for each character. now the fields open up for you to put your respective character’s idle ,walk and run animation clips into it.

Now you have AnimatonOverrideControllers for each character with their respective walk,run and idle clips.

in your code just use whichever animator you want .

also check out these topic which are relevant

Resource.Load, Animator.runtimeAnimatorController .

https://blog.karatos.in/a?ID=00500-cd53a866-6b82-4ee6-a09f-b77bb31fc774