How do I import some of the actions from a .blend with a Wrap Mode set as ‘Once’, and others as ‘Loop’?
elaboration:
I have a .blend file saved in my assets folder, containing an animated model w/ multiple animations. The animations all show up in Unity, and I can see they are playing correctly. The only issue is, I’d like to set the animation wrap mode to “Once” for SOME of the animations, but, the Wrap Mode option in the inspector window under the FBXImporter settings seems to set the importer to import ALL animations as Once.
Thanks!
(forgive me if this seems like a n00b question. I did a quick search of the forums before posting, so I hope this hasn’t been addressed ad nauseum. )
Welcome to the forum. I am not sure if this helps, as I am using Blender 2.5.
Can’t you select a single animation and change the FBXImport setting per animation?
If not, you may copy the animation and change the wrap mode there. But then you have to add the animation to the animation list of your model. And be careful, if you change one of those animations in Blender, your copied animation won’t change. So you would have to copy it again and change the wrap mode.
You should use a script to set up and activate your animations, including the wrap modes. Look for Animation Wrap Mode on the scripting section of the manual, and take a look at any of the animations scripts of the tutorials.
@Dantus: The option to set individual animation options via the inspector GUI is disabled. When you say copy and change wrap mode there, are you referring to Blender? Thanks for the reply.
@GusM: That sounds like the right path to take, since I’m going to be manipulating animation in script anyway. I’ll read up on how to do that. Thanks for the idea.
If you change the wrap mode in a script (which is actually the better way!), you don’t have to copy the animation. What I meant was to select the animation in Unity in the Project tab and copy it (CTRL-D). In the copy, you may change everything. But the scripting solution is better!
Ah, I see what you’re saying now. I was able to copy and edit the property, but, for some reason, in-game the character keeps looping the animation. I’ll try it via script and let you know how that goes.
Edit:
I’m thinking the looping is related to the way that the 3dPlatformTutorial scripts the animation: animation.CrossFadeQueued(“sw1”, 0.1, QueueMode.PlayNow);
Ok, I figured it out. I was setting the wrapMode in the Start function, and I needed to do it in the ‘DidPunch’ function (called via condiational statement in the update() function). It now plays once. It makes sense now that I think about it.
Now, it appears that I have to re-initialize the animation somehow after the animation plays, b/c after I play the animation 1 time, it doesn’t play again when I hit the button that initiates the function.
EDIT - UPDATE(FIXED): I realized the animation wrap mode was set in the main character animation script’s start function, NOT the function that I was editing. That is (apparently) why I couldn’t set the wrap mode of the animation in the CharacterAttack script.
(I’m editing/playing w/ the 3dPlatformTutorial (Lerpz) by the way)