- Home /
The name 'PackedSprite' does not denote a valid type ('not found')
what is that not working. I attached this script on my sprite created by SM2
Blockquote
var speed : float = 0.01; var updown : float = 0.01;
var sprite : PackedSprite = GameObject.GetComponent("PackedSprite");
function Update () {
var translation : float = Input.GetAxis ("Horizontal") * speed; var updown : float = Input.GetAxis ("Vertical") * speed;
translation = Time.deltaTime; updown = Time.deltaTime;
transform.Translate (translation, updown , 0);
if (translation > 0 ) { transform.localScale = Vector3(-1,1,0); sprite.PlayAnim("idle"); }
Blockquote
Answer by Jean-Fabre · Mar 11, 2011 at 06:15 AM
Hi Lesfundi,
Can you double check that you have correctly install SM2? you should have it in your Plugins folder. If not follow the instructions given when you purchased SM2, and you should have the PackedSprite.cs file under Plugins/Sprite scripts/ in your Project view.
It could also be a problem with this script and where it is in your project, since PackedSprite is a cs file and your script is in js, there are some considerations to be aware of. Try to write this script in cs and see if it pass.
check this for full explanation:
http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html
Hope it helps,
Jean
Answer by lesfundi · Mar 11, 2011 at 12:13 PM
indeed. It was in cs but not in Java. So, SM2 only works with cs?
Answer by Brady · Apr 28, 2011 at 07:43 PM
SM2 works with JavaScript, but you have to make sure the SM2 files are where they are put when you originally import the package. That is, all the scripts are grouped under the "Plugins" folder. Also, make sure your own JS scripts which call SM2 aren't inside one of the other "priority" folders like Plugins, Standard Assets, etc. If they are, then it defeats the purpose of having the "Plugins" folder, which makes sure the C# gets compiled before the JS.
If you do that, all should be well.
Your answer
Follow this Question
Related Questions
error CS1520: Class, struct, with Sprites 3 Answers
Sprite Manager Play animation 0 Answers
SpriteManager 2 pixel perfect blurry and stretched 2 Answers