Tutorial for Blend Shapes in Unity

#1
  1. Import the FBX file into Unity. You can drag and drop it into the appropriate asset folder.
    image-20220224044128491.png
  2. On the Import Settings file, under the Model tab, make sure that the "Import BlendShapes" button is checked.
    This is an example of what the file will look like:
    image-20220224044630125.png
    image-20220224044556722.png
  3. In the Rig tab, set "Avatar Definition" to "Create From This Model".
    Slime Rig.png
  4. Create an "Animation Controller" for the new slime type, adding in the necessary animations, parameters, and settings to trigger the animation. (Once the controller is made, you can either drag one animation on at a time or you can drop the FBX file onto the controller). For more information about the animator system, visit Unity Docs.
    image-20220224045343590.png image-20220224045521438.png
    An example of a setup animator:
    image-20220224045748095.png
  5. Add the imported FBX file to the scene (I would suggest the art scene for ease of use, regardless of the scene used, the changes to the scene will be deleted after).
    image-20220224050424408.png
  6. Add an Animator component to the new slime in the scene (if not already there) and attach the newly created controller.
    image-20220224050513292.png
  7. Add the SlimeBlendShapes.cs file as a component to the slime.
    image-20220224050627969.png
  8. Continued below.
 
Last edited:
#2
  1. Above
  2. Above
  3. Above
  4. Above
  5. Above
  6. Above
  7. Above

  8. Open the SlimeBlendShapes.cs file. You can click on the name where it now shows in the inspector (the greyed-out part) to jump to its location in the assets folder.
    image-20220224050742252.png
  9. Find the SlimeBlendShape enum and make sure it includes the necessary BlendShape state(s) and place value(s).
    image-20220224051210182.png
  10. Add the necessary code to UpdateMesh()—see previous code for examples.
    image-20220224051249182.png
    • Use the following if the blend shape goes the entire duration of the animation slimeSkinMeshRend.SetBlendShapeWeight((int)SlimeBlendShape.BlendShapeStateNameEnteredHere, (currentTime / MaxTime) * 100);
  11. If there is code currently used to call the interaction (i.e. Feed()), make sure that the animations are set to trigger there.
    image-20220224051657990.png
  12. Check to see if the animation plays by running the scene and triggering the animation manually via the animator if there is no code to currently call the interaction.
  13. Drag new slime into the appropriate assets folder to create a prefab and delete changes from the current scene.
    image-20220224051956661.png
 
Last edited:
Patreon
Top