- Home /
Sprite Manager Play animation
HI guys .. i need your help,, i have gameObject with packedSprite.cs (Sprite Manager 2) Script on it.. and have 1 animation with name "walk",.
then i adding new script in this game object the name is randomMover.cs ..
i want to play animation "walk" with randomMover.cs but always fail
 public class randomMover : SampleBase {
 
 private PackedSprite animSprite = GetComponent(typeof(PackedSprite)) as PackedSprite;
 
 void Start(){
   animSprite.PlayAnim("walk");
 }
 
 }
the result is error :
Assets/Spawner/Example/Script/RandomMover.cs(33,43): error CS0236: A field initializer cannot reference the nonstatic field, method, or property `UnityEngine.Component.GetComponent(System.Type)'


Thanks
Your answer
 
 
             Follow this Question
Related Questions
2.5 platformer sprite animated character 3 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
How to deal with an animation from sprites of different sizes? 0 Answers
2d animation import 1 Answer
The name 'PackedSprite' does not denote a valid type ('not found') 3 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                