- Home /
Animator does not contain definition for "runtimeAnimationController"
Unity Version: 2021.1.16f1 Personal
I'm attempting to execute this code:
 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using System.ComponentModel;
 
 public class PawnActionAnimationDispatch : MonoBehaviour
 {
     private Animator animator;
     private PawnBase pawn;
     public bool isFront = true;
 
     void Start()
     {
         animator = GetComponent<Animator>();
         pawn = GetComponentInParent<PawnBase>();
         pawn.OnAction += OnAction;
     }
 
     void Update() {
         animator.SetFloat("HorizontalMovement", pawn.IsFacingLeft() ? -1 : 1);
         animator.SetFloat("VerticalMovement", pawn.IsFacingUp() ? 1 : -1);
     }
 
     void OnAction(PawnActions.PawnAction action)
     {
         animator.runtimeAnimationController = Resources.Load("Animation/Weapons/Sword/Front/SwordFrontAnimationController") as RuntimeAnimationController;
         animator.SetTrigger("Act");
     }
 }
 
This should work, according to documentation found here: https://docs.unity3d.com/2021.1/Documentation/ScriptReference/Animator.html
I'm receiving errors:
 Assets\Scripts\Animation\PawnActionAnimationDispatch.cs(26,18): error CS1061: 'Animator' does not contain a definition for 'runtimeAnimationController' and no accessible extension method 'runtimeAnimationController' accepting a first argument of type 'Animator' could be found (are you missing a using directive or an assembly reference?)
 Assets\Scripts\Animation\PawnActionAnimationDispatch.cs(26,128): error CS0246: The type or namespace name 'RuntimeAnimationController' could not be found (are you missing a using directive or an assembly reference?)
The error messages lead me to believe that there's some different namespace or something for these things, but as far as I can tell through extensive Googling, there isn't. I'm really stumped, which is why I've turned here for help.
As a sanity check, I even followed some code found here to ensure that runtimeAnimationController was even a property on Animator still: https://stackoverflow.com/questions/852181/c-printing-all-properties-of-an-object
I hate to be the guy shouting that this is a bug with Unity, but I'm also entirely out of ideas. Is this something anyone else has seen before? Am I crazy? Any feedback or suggestions would be great!
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                