I’m trying to access a static function from other script, but this function has a code"animation.Stop()". Now unity says “An instance of type ‘UnityEngine.Component’ is required to access non static member ‘animation’.”. Like this it gives same error at this code too “animation.IsPlaying(hit.name)”. As far as i can understand, animation is not a static member, but is there a any static member does the same thing?
Pass the animation
object into the static function. For instance make the static function similar to
public class SomeClass {
public static void MyFunction(Animation animation) {
// Some code
animation.Stop();
// Some more code
}
}
and the call
SomeClass.MyFunction(animation);