MAB: Setup & Installation
Getting the system up and running in your project is a straightforward process.
1. Import the Scripts
Place the five core scripts into your Unity project’s Assets folder.
MeshAnimation.csMeshAnimator.csMeshInstancingManager.csAttachmentPoint.cs
It is highly recommended to place the AnimationBaker.cs script inside an Editor folder (e.g., Assets/Editor). This is standard Unity practice for editor tools.
2. One-Time Scene Setup
The entire system is controlled by a single manager.
- Create a new, empty
GameObjectin your scene (a good name is_Managersor_Systems). - Add the
MeshInstancingManager.csscript to this GameObject. - Select the
_ManagersGameObject and look at the Inspector. You will see theMesh Instancing Managercomponent. Here, you must define your global LOD distances.- LOD Distances: This is an array of float values that define the maximum distance for each Level of Detail. They must be sorted from nearest to farthest.
Element 0: 25 (Means LOD 0 is used for characters up to 25 meters away).Element 1: 60 (Means LOD 1 is used for characters between 25 and 60 meters).Element 2: 120 (Means LOD 2 is used for characters between 60 and 120 meters).- Characters beyond the last distance (120m) will be automatically culled (not rendered).
- LOD Distances: This is an array of float values that define the maximum distance for each Level of Detail. They must be sorted from nearest to farthest.
That’s it! The scene is now ready. The next step is to prepare your character models and bake their animations.