x


Saving AnimationStates in prefabs broken?

I have a script that automatically generates animation clips from spritesheets. I want to create a GameObject add the created clips to it and save it as a prefab. All this should happen in the script, no manual work. This works only as long as clip name and AnimationState name are the same e.g.:

string animName = "walk";
string clipname = animName + ".anim";
animation.AddClip(clip, animName);

will work. But I if I do this:

string animName = "walk";
string clipname = "Berserker - " + animName + ".anim";
animation.AddClip(clip, animName);

It will add the correct animation states to Animation, but when I save it as prefab (or press apply, doesn't matter) the prefab will show an empty animations list. Is this a bug, or is there an explanation why this can't work?

more ▼

asked Sep 20 '10 at 01:05 PM

StephanK gravatar image

StephanK
6k 40 53 93

I think you should post larger snippet of code, because in this case it isn't clear where the clip comes from and where clipname is used.

Sep 21 '10 at 07:20 AM Paulius Liekis
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x5270
x3927
x529

asked: Sep 20 '10 at 01:05 PM

Seen: 1054 times

Last Updated: Sep 20 '10 at 01:13 PM