- Home /
Question by
Mativve · Jan 18, 2017 at 04:02 PM ·
scripting problemerror message
Error CS0138 with UnityEngine.Animation
Hi! I have a problem. I want use using UnityEngine.Animation; in my script but unity show me error:
Assets/animation/PlayerMovement.cs(4,1): error CS0138: A `using' directive can only be applied to namespaces but `UnityEngine.Animation' denotes a type. Consider using a `using static' instead
When I change using to using static
using static UnityEngine.Animation;
unity show me next error:
Assets/animation/PlayerMovement.cs(4,7): error CS1644: Feature `using static' cannot be used because it is not part of the C# 4.0 language specification
Somebody know what wrong with my unity? Or I do something wrong? Please help!
Comment
Best Answer
Answer by Hellium · Jan 18, 2017 at 05:16 PM
Simply add at the top of your file :
using UnityEngine;
In your class, you will be able to directly declare an animation :
public class MyClass : MonoBehaviour
{
public Animation anim ;
}
Otherwise, you can do as follow :
public class MyClass : MonoBehaviour
{
public UnityEngine.Animation anim ;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612105100im_/https://answers.unity.com/themes/thub/images/avi.jpg)