<aside> <img src="/icons/reorder_gray.svg" alt="/icons/reorder_gray.svg" width="40px" />
Navigation
</aside>
Your model should support a humanoid rig.
To check it, select model, in the Inspector window you’ll find Import Settings.
Select the Rig
tab, make sure the Animation Type is Humanoid
, and there are no errors.
Drag your model into the scene and select it. The model should have an Animator
component on it.
Add a component called Character Enemy
Scroll down to the bottom of Character Enemy
(Script), there is a button called Print bones names
. Press it. In the Console window, you’ll see a list of bones names and names of actual game objects in your model that represent those bones. We will need this list in the next step.
Click Game Object -> 3D Object -> Ragdoll…
Drag all required bones from your model into the Create Ragdoll window. You can use list of bones names and actual objects printed in Console to quickly find correct bones. Click Create
.
After that process, Rigidbodies, Colliders, and Joints will be added to the model’s bones.
Select your model again, in the Inspector window find Character Enemy (Script) scroll to the bottom, and find the button Create and Init
. Press it. If you didn’t have any errors in the console only the message “Setup Completed” - it means you correctly set up rig for your character.
Now you can adjust collider sizes to fit the character shape better.
2 references need to be assigned:
on Character Enemy (Script) find the Scenarios list. Add these 2 premade scenarios located in the Project Files/Data/Enemies System/Scenario folder.
on Character Enemy (Script) find Selected Gun field and drag there Enemy Gun asset, located at Assets/Project Files/Data/Guns System/Guns/Enemy Gun.asset
Create a prefab out of this model, for this drag the character object from Hierarchy into Project view (folder Assets/Project Files/Game/Prefabs/Enemy and Obstacles
)
To replace old enemies in the levels follow next instructions:
Find the next folder: Assets/Project Files/Data/Level System/Level Stages
Double-click on each stage with enemies to open its prefab
Click the Add Component
button, start typing Replace Enemy Tool
, and select Replace Enemy Tool script
Drag newly created enemy prefab into field called New Enemy Prefab
And click Replace - all old enemies will be replaced. Open the next stage prefab and repeat steps c-e