My animator doesn’t work: I set a bool variable from code:
animatedObject.myAnimator.SetBool("MyVariable", true);
animatedObject.SetActive(true);
But the animation isn’t triggered. I’m sure that the animator’s transition is correctly set to react with «MyVariable».
Looking at the output console, I see that I have a warning:
animator is not playing an animation controller
What does that mean?
asked Mar 9, 2018 at 21:38
Basile PerrenoudBasile Perrenoud
4,0313 gold badges29 silver badges52 bronze badges
The warning is not really helpful but what it means is that the AnimationController is disabled, or is on an inactive object. It will not be able to set variable since it currently doesn’t have a state.
Simply inverting the two lines, so that the animator is on an active object, will solve it:
animatedObject.SetActive(true);
animatedObject.myAnimator.SetBool("MyVariable", true);
answered Mar 9, 2018 at 21:38
Basile PerrenoudBasile Perrenoud
4,0313 gold badges29 silver badges52 bronze badges
The warning Animator is not playing an AnimatorController
also appears, when the Animator somehow lost the reference to the Animator Controller asset.
You can see it here in screenshot, where the Animator value for Controller is «None».
Just drag in the missing Animator Controller asset from your project view.
answered Mar 9, 2018 at 23:26
This warning also occurs, when you try to run methods on an Animator (SetFloat/Play/etc.) that is attached to a Prefab, instead of a instantiated GameObject.
For example:
You have a GameObject (name — «MyLists») with List type Duck.
Duck is just a regular prefab with a script that has a method , let’s say.. «ShowUp()» .
The list fullfills with Duck GameObjects by itself. Doesn’t matter how.
Your other GameObject (name — «Manager») on a scene runs method «ShowUp()» on every Duck GameObject in the list. But because of some reason, you want to run method «ShowUp()» even if there are no object (no Ducks) on the list. Because this method makes some cool stuffs. So you assign the Duck Prefab to the Manager GameObject, so it can take a script from this Duck prefab, and run method «ShowUp()». If the method «ShowUp()» has something like «animator.SetFloat(…)», it will cause an warning we’re talking about.
*It will not cause an error «animator not assigned», because Duck prefab may have assigned «animator» in the Inspector.
Next part of this post is about a real «Duck» problem that I’ve had
You don’t need to read it if you’re not interested, you already know everything that you need about error/warning we’re talking about.
You can say.. Well, that’s weird thing won’t ever happen, why should I run «ShowUp()» when there are no Ducks. But that’s not true. Look at this:
I make a multiplayer game with object pooling. Only the Master Client (or server) can add new objects to the pool. After that he send message to everyone that he has just created a new object in the pool, and everyone needs to that in theirs local pools too (to stay synchronized). Of course, all this time the Master Client sends data about every object in the pool to other players, so they can be synchronized (like position, velocity, etc.). Every data he sends MUST be read by a client. If that won’t happen client may read «old» data as a new message, and assing values (like position, velocity) to a different object in the pool. In case Master Client adds new object to the pool, he starts to send data about it to everyone. Sometimes client won’t catch up to make this new object before he gets informations about it. So he need to make something like «fake read», just read informations but do not assign them to any gameobject (because he didn’t create the proper one). That is when I want to use Read method from a prefab, I just set a parameter fakeRead to True in method Read(bool fakeRead) and it does a fake read. If in my Read method I use animator.SetFloat((float) stream.ReceiveNext()) it will cause an warning we’re talking about, because an animator is a prefab’s animator.
Let’s say the Master Client has just created third object, and he now sends informations about objects.
for every object: object.SendsInfo() (it will runs 3x times)
Client didn’t create object3 yet, but he receives data:
for every object: object.Update(stream.ReceiveNextData()) (it will runs 2x times)
in next loop Client will subscrive informations about object3 to object1 !!!
Of course I propably can walk around this problem in a different way, maybe like flushing streams, change the way master communicates with client, etc. But hey! that’s my solution for now and it works perfect!
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
- Pick a username
- Email Address
- Password
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement. We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
The warning is not really helpful but what it means is that the AnimationController is disabled, or is on an inactive object. It will not be able to set variable since it currently doesnt have a state.
Simply inverting the two lines, so that the animator is on an active object, will solve it:
animatedObject.SetActive(true);
animatedObject.myAnimator.SetBool(MyVariable, true);
The warning Animator is not playing an AnimatorController
also appears, when the Animator somehow lost the reference to the Animator Controller asset.
You can see it here in screenshot, where the Animator value for Controller is None.
Just drag in the missing Animator Controller asset from your project view.
c# – Animator is not playing an animation controller
Tezr0 0 / 0 / 0 Регистрация: 13.09.2022 Сообщений: 1 |
||||
1 |
||||
13.09.2022, 15:34. Показов 697. Ответов 1 Метки unity (Все метки)
Привет всем читающим. Я новичок в юнити. Делаю игру битва башен. Столкнулся с проблемой «animator is not playing an AnimatorController». После призыва скелета(префаб) он идёт вперёд все спокойно, он стреляет и когда враг попадает в триггер который висит на скелете он стреляет во врага, при попадании происходит эта ошибка «animator is not playing an AnimatorController». В инспекторе все указано. Скрипт скелета:
0 |
My animator doesn’t work: I set a bool variable from code:
animatedObject.myAnimator.SetBool("MyVariable", true);
animatedObject.SetActive(true);
But the animation isn’t triggered. I’m sure that the animator’s transition is correctly set to react with «MyVariable».
Looking at the output console, I see that I have a warning:
animator is not playing an animation controller
What does that mean?
asked Mar 9, 2018 at 21:38
Basile PerrenoudBasile Perrenoud
4,0013 gold badges29 silver badges52 bronze badges
The warning is not really helpful but what it means is that the AnimationController is disabled, or is on an inactive object. It will not be able to set variable since it currently doesn’t have a state.
Simply inverting the two lines, so that the animator is on an active object, will solve it:
animatedObject.SetActive(true);
animatedObject.myAnimator.SetBool("MyVariable", true);
answered Mar 9, 2018 at 21:38
Basile PerrenoudBasile Perrenoud
4,0013 gold badges29 silver badges52 bronze badges
The warning Animator is not playing an AnimatorController
also appears, when the Animator somehow lost the reference to the Animator Controller asset.
You can see it here in screenshot, where the Animator value for Controller is «None».
Just drag in the missing Animator Controller asset from your project view.
answered Mar 9, 2018 at 23:26
Tezr0 0 / 0 / 0 Регистрация: 13.09.2022 Сообщений: 1 |
||||
1 |
||||
13.09.2022, 15:34. Показов 365. Ответов 1 Метки unity (Все метки)
Привет всем читающим. Я новичок в юнити. Делаю игру битва башен. Столкнулся с проблемой «animator is not playing an AnimatorController». После призыва скелета(префаб) он идёт вперёд все спокойно, он стреляет и когда враг попадает в триггер который висит на скелете он стреляет во врага, при попадании происходит эта ошибка «animator is not playing an AnimatorController». В инспекторе все указано. Скрипт скелета:
__________________ 0 |
Мой аниматор не работает: я установил переменную типа bool из кода:
animatedObject.myAnimator.SetBool("MyVariable", true);
animatedObject.SetActive(true);
Но анимация не запускается. Я уверен, что переход аниматора правильно настроен на реакцию с «MyVariable».
Глядя на консоль вывода, я вижу предупреждение:
аниматор не воспроизводит контроллер анимации
Что это значит?
2 ответа
Лучший ответ
Предупреждение не очень полезно, но оно означает, что AnimationController отключен или находится на неактивном объекте. Он не сможет установить переменную, так как в настоящее время у нее нет состояния.
Простое инвертирование двух линий, чтобы аниматор находился на активном объекте, решит эту проблему:
animatedObject.SetActive(true);
animatedObject.myAnimator.SetBool("MyVariable", true);
2
Basile Perrenoud
9 Мар 2018 в 21:38
Предупреждение Animator is not playing an AnimatorController
также появляется, когда Animator каким-то образом теряет ссылку на ресурс Animator Controller.
Вы можете увидеть это здесь, на снимке экрана, где значение Animator для Controller равно «None». Просто перетащите недостающий ресурс Animator Controller из представления проекта.
2
JeanLuc
9 Мар 2018 в 23:26
Unity 5.6, Spine & Spine-Unity runtime 3.6
Used SkeletonAnimator instead of SkeletonAnimation in scene, and encountered the error:
Animator is not playing an AnimatorController
UnityEngine.Animator:get_layerCount()
The controller is the default one; I didn’t change it, simply set the clips up. There’s only the base layer and no parameters used.
Hmmm…what did I do wrong? I tried google this error, but seems it’s relatively rare.
Thanks!
5.5 years ago
- Lavennin
- Сообщения: 1
TedNindo
I am having the same warnings. A lot of them. Quite sure they are new so I am not sure why they pop up.
I am using the runtime version 3.6.x.x Since this thread is over 8 months old I think I should have the fixed version.
Animator is not playing an AnimatorController
UnityEngine.Animator:get_layerCount()
Spine.Unity.MecanimTranslator:Apply(Skeleton) (at Assets/spine-unity/SkeletonAnimator.cs:161)
Spine.Unity.SkeletonAnimator:Update() (at Assets/spine-unity/SkeletonAnimator.cs:78)
The link above is dead so I can’t fix it myself-
4.5 years ago
- TedNindo
- Сообщения: 46
Pharan
Did the warnings appear just now? What changed?
Are you using the latest? This should be included in the unitypackage by now.
Spine Unity Download
4.5 years ago
-
Pharan - Сообщения: 5366
- Сайт
TedNindo
Thanks, Pharan,
I updated once more, as it seems I did not have the very last version of the runtime libs. Seems as if the errors are gone. Thanks a lot.
4.5 years ago
- TedNindo
- Сообщения: 46
wayward_ed
I’ve just started using Spine (great software package!), and I’m seeing these same warnings with the latest unity runtime (the one dated 4/25).
Animator is not playing an AnimatorController
UnityEngine.Animator:get_layerCount(Animator)
Spine.Unity.MecanimTranslator:Apply(Skeleton) (at Assets/ImportedPackages/Spine/spine-unity/Components/SkeletonAnimator.cs:180)
Spine.Unity.SkeletonAnimator:Update() (at Assets/ImportedPackages/Spine/spine-unity/Components/SkeletonAnimator.cs:82)
They don’t happen all the time, but every now and then I’ll do something in the editor that tickles this and causes these to appear when I make any changes to the scene. If I run the game and then drop back into edit mode, they go away for a while, but they always seem to come back.
4.5 years ago
- wayward_ed
- Сообщения: 1
Dmitriy Makeyev
The guys have already passed a year, many updates have been released. Warning that was a year ago and remained.
Animator is not playing an AnimatorController
UnityEngine.Animator:get_layerCount()
Spine.Unity.MecanimTranslator:Apply(Skeleton) (at Assets/Spine/spine-unity/SkeletonAnimator.cs:139)
Spine.Unity.SkeletonAnimator:Update() (at Assets/Spine/spine-unity/SkeletonAnimator.cs:82)
Jungle Town «Birthday quest»
4 years ago
-
Dmitriy Makeyev - Сообщения: 48
Pharan
This was supposed to be already fixed in the latest version.
If you are seeing this in the latest version, do you have a repro case you can send to us?
unity@esotericsoftware.com
4 years ago
-
Pharan - Сообщения: 5366
- Сайт
dcheglakov
Dmitriy Makeyev писал(а):The guys have already passed a year, many updates have been released. Warning that was a year ago and remained.
Animator is not playing an AnimatorController
UnityEngine.Animator:get_layerCount()
Spine.Unity.MecanimTranslator:Apply(Skeleton) (at Assets/Spine/spine-unity/SkeletonAnimator.cs:139)
Spine.Unity.SkeletonAnimator:Update() (at Assets/Spine/spine-unity/SkeletonAnimator.cs:82)
Hey, try to remove Spine from Unity completely and re-import again. This helped me.
4 years ago
- dcheglakov
- Сообщения: 1
Dmitriy Makeyev
Removed, set again. At first, I was told that there were zero warnings, but then again, at once, 500 — 600 messages of the following content:
spine-unity-3_7-2019-04-27
Animator is not playing an AnimatorController
UnityEngine.Animator:get_layerCount()
Spine.Unity.MecanimTranslator:Apply(Skeleton) (at Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs:222)
Spine.Unity.SkeletonMecanim:Update() (at Assets/Spine/Runtime/spine-unity/Components/SkeletonMecanim.cs:85)
Jungle Town «Birthday quest»
3.5 years ago
-
Dmitriy Makeyev - Сообщения: 48
Harald
Thanks for reporting the problem. We have just fixed the issue, it will be released together with the next unitypackages.
I will let you know as soon as it is available for download.
—
The unitypackages are now ready for download:
Spine Unity Download
3.5 years ago
-
Harald - Сообщения: 4451
Вернуться в Unity