The avatar manger can be used to manage multiple avatar meshes for a single humanoid. It is supported single player and networking setups.
The Avatar Manager script can be found in Assets/Humanoid/Scripts/Tools/ and should be attached to an GameObject with the Humanoid Control component script.
The Avatar Manger script shows the list of available avatars to use. Every avatar needs to have a Animator component attached and only avatars from the Project Window (prefabs, models) are supported, so you cannot use avatar in you scene.
New avatars can be added to the list by clicking Add Avatar while empty slots will be cleaned up automatically.
The Current Avatar Index shows the index number of the avatar which is currently used. At startup, this value will determine which avatar is used when the scene is started. Note: this will override the avatar which is attached to the Humanoid Control!
When Networking Support is set to Unity Networking or Photon Networking, additional entries for the third person avatar will be shown.
These values match the behaviour of the Remote Avatar in the Humanoid Control script: at the local client, the first person avatar is used, while the third person avatar is used on remote clients. This will enable you to optimize the avatars for each case.
If the Third Person avatar is left to None, like for Robot Kyle in the example above, the First Person avatar will also be used for remote clients.
The avatar can be set using one of the following functions:
|SetAvatar(int avatarIndex)||this will replace the current avatar by with the avatar indicated by the avatarIndex.|
|NextAvatar()||replaces the current avatar by the next avatar in the list||wrapping around when the last avatar is the current avatar.|
|PreviousAvatar()||replaced the current avatar by the previous avatar in the list||wrapping around when the first avatar is the current avatar.|
Especially the Previous/Next Avatar function are suitable to be used in combination with Input like the Controller Input: