Since Editor Pack 7, all space users now have the ability to create a full body replacement costume. The costume allows you to replace the space avatar base mesh with any object you want, such as another human avatar, an animal or an object; You can even use particle systems as your avatar!
There are two parts to getting a costume working in space. You will need to first create or import your replacement costume, and then you will need to build an animator for this replacement costume. For the animations, you will need to create your own custom animations if you wish to use an object or creature as your replacement costume, but if you are using a humanoid as a replacement, you can use the default space animations, but more in detail on this later on in this guide.
You can create whatever you want to be your replacement costume, whether it be a unicorn, a wrestler or even a fire particle, anything is possible! You can create your own costume in your chosen 3D software and import it into Unity.
If you have made your own costume, you will need to export the costume from your chosen 3D software as an FBX file and save it somewhere for importing into Unity later.
If you have decided to download an object/model to use as your costume from the Unity Asset Store, then you probably won’t have to change the format of the model as most models on the asset store are already in FBX format.
Once the asset has downloaded, it will ask you to import the model into Unity. I am using a warrior princess model for this guide.
Make sure you have selected all of the assets by clicking on ‘All’ then click on ‘Import’. This will make a new folder in your Assets folder with all of the items needed for your costume.
After the above step of exporting from the 3D software as an FBX file, you can import this into Unity by clicking on ‘Assets’ and choosing ‘Import New Asset’ at the top of the Unity screen. Then choose your FBX file. This will place the FBX file into your Assets folder.
If your costume is a humanoid model, and you want to use it with the default space animations, you will have to get it setup to work with the animations.
You will have to uncheck the ‘Apply Root Motion’ box if the FBX has an animator already attached to it. You can do this by clicking on the FBX in your hierarchy and finding the ‘Apply Root Motion’ box in the inspector window. If Apply Root Motion is greyed out, drag the FBX into your scene, then back to the project window to create a prefab.
Click on the FBX file you have imported in the project window, and under the Inspector window, choose ‘Rig’, and set the animation type to ‘Humanoid’. This will enable you to be able to use the default space animations for the replacement costume.
If you have chosen to use an object or animal as your replacement costume, or you want to create your own animations for a humanoid, you will need to create an animator.
Animators allow you to upload completely custom animations with the replacement costume.
Animators need a controller to work, so you need to create a controller. To create a controller, right click in your project window, and choose ‘Create’ then ‘Animator Controller’ and begin laying it out.
This is a complex step, but you can use the space editor pack controller as a template for laying out the animators; Just search for ‘Player Controller’ in the project window.
An animator controller transitions animations based on input variables - we let you insert a few variables in here (we may add more over time). Your animator needs to have all these variables listed - even if it does not use them.
These variables are:
See example:
After setting the rig type to humanoid, you can go ahead and upload your costume. To upload it, first create a new empty gameobject in your scene. Click on the gameobject in the hierarchy, and click on ‘Add Component’ in the Inspector window. Search for ‘Clothing Item Settings’ and click ‘Add’. This will bring up the clothing item settings. Make sure to expand the ‘Slots’ segment for the next step.
Slots
For costume uploads, you need to make sure all of the slots are checked under the ‘Slots’ segment. Do not check the animator slot.
After this, check ‘Attachment’ and move on to the Extended Settings.
Extended Settings
Under the Extended Settings, you will see the ‘Custom Skeleton’ option. Open this up, and you will see ‘Root Template’. This ‘Root Template’ will be the prefab of the FBX you want to use as the costume. Drag the prefab to the box next to ‘Root Template’ from your project window, NOT the hierarchy.
Finalise
Before preparing, you may need to rename this empty gameobject to something else, otherwise it won’t prepare. You can rename it by scrolling to the top of the Inspector window and clicking in the box right at the top. I renamed mine to ‘Warrior Princess’.
After renaming, click on ‘Prepare’. If it is successful, it will say ‘Re-Prepare’ after a couple of seconds. Save this as a prefab by dragging the gameobject into your project window.
Uploading
Now you are ready to get the costume uploaded to space. Click on the prefab of your costume in the project window. In the Inspector window, click on ‘Add Component’ and search for ‘Virtual Good’ and add it.
Set the content type to ‘Clothing’ and fill in the rest of the information as you see fit. You can pick any category of clothing for the costume, it doesn’t matter which category it is under.
After it’s all filled out, you can click on ‘Automatic Submission’ to get it uploading to space.
To upload a costume with custom animators, follow the upload steps as above, but check ‘Animator’ under the ‘Slots’ segment.
Scroll down to custom animations, and drag the animator controller you made into the ‘Controller’ slot.
You need to insert the names you used for the variables under the Parameters section into the various fields. These are case and syntax sensitive, so copy them exactly as they are.
After doing this, follow the steps above to make your costume a virtual good with the virtual goods script, and your costume will get uploading to space.
For more information and tutorials on animations, see below:
|