When building the project, an error appears that "The type or namespace name 'Animations' does not exist in the namespace 'UnityEditor'", but Visual Studio does not show errors and all the libraries are connected, I found a solution how to upload the dll file to the Plug-in but could not find where to download dll file UnityEditor. I want to use the Animator Controller in a unity editor.
using UnityEngine;
using UnityEditor.Animations;
public class SkinSetter : MonoBehaviour
{
public Animator anim;
public AnimatorController skin1;
public AnimatorController skin2;
public AnimatorController skin3;
public AnimatorController skin4;
public AnimatorController skin5;
public AnimatorController skin6;
public AnimatorController skin7;
public AnimatorController skin8;
private void Start()
{
SetSkin(PlayerPrefs.GetInt("SkinSelect"));
}
public void SetSkin(int ID)
{
switch (ID)
{
case 1:
anim.runtimeAnimatorController = skin1;
break;
case 2:
anim.runtimeAnimatorController = skin2;
break;
case 3:
anim.runtimeAnimatorController = skin3;
break;
case 4:
anim.runtimeAnimatorController = skin4;
break;
case 5:
anim.runtimeAnimatorController = skin5;
break;
case 6:
anim.runtimeAnimatorController = skin6;
break;
case 7:
anim.runtimeAnimatorController = skin7;
break;
case 8:
anim.runtimeAnimatorController = skin8;
break;
}
}
}
UnityEditoris a namespace specific for Unity Editor internal stuff and custom editor scripts ... it is not available in a build so you don't want to use anything from it in aMonoBehaviour!#if UNITY_EDITOR...