- Home /
Ped models do not want to play one animation at the same time
Hello, I have a question. Is that unity limit or something that when I have placed on map several peds, only first one plays walk animation on start game but when I place next one ped during game hi plays animation with no problem. When they trying play walk animation at the same time, only one can but when their instantiate has a time interval all peds plays walk animation. Only one model per frame can have access to animation controller? Strange thing is that everybody play idle animation before script find new path. Game see walks animation as is playing for those models what don't act like this animation is working In animator table idle animation is playing despite I turned it off in script. (Is turned off for ped with working walk animation but every peds has the same script)
No, there isn't a limit on the number of objects that can use an animation (it would be really weird). $$anonymous$$ore likely what is happening is that the animation is not looped, either in its settings or in its AnimatorController, or the animation is stopped in an animator script.
Please check if any of this is the issue, and if not, please give a bit more information about your setup.
In update I have somethink like this:
float anima=0.3f
anim.SetFloat("Walking", anima);
anim.SetFloat("WalkingBack", 0);
anim.SetBool("IsRunning", false);
anim.SetBool("IsIdle", false);
For first ped animations works good, for second ped script cant change walking value to 0.3, in animator is still 0. both have the same script. Both are placed on map before start. After start when I will add more peds, their animations will works fine.
Answer by Harinezumi · Jun 01, 2018 at 12:23 PM
Do you use any static variables? How do you assign the anim
variable? Could it be that the second ped's anim
variable points to the first ped's? (That happens if you copy a component from one to the other).
I totally forgot about that animator was as static, thank you, now when I changed it animations works good for all peds
Great, I'm glad I could help!
I converted the comment to an answer, so that others might find it easier as well.