x


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

more ▼

asked Mar 11 '11 at 03:12 AM

lesfundi gravatar image

lesfundi
12 1 1 2

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Apr 28 '11 at 07:43 PM

Brady gravatar image

Brady
137 1 1 4

(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Mar 11 '11 at 06:15 AM

Jean Fabre gravatar image

Jean Fabre
3.1k 68 75 103

(comments are locked)
10|3000 characters needed characters left

indeed. It was in cs but not in Java. So, SM2 only works with cs?

more ▼

answered Mar 11 '11 at 12:13 PM

lesfundi gravatar image

lesfundi
12 1 1 2

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3790
x215
x52
x51

asked: Mar 11 '11 at 03:12 AM

Seen: 3208 times

Last Updated: Mar 11 '11 at 03:12 AM