Version: 2020.1
언어: 한국어

AvatarBuilder.BuildGenericAvatar

매뉴얼로 전환
public static Avatar BuildGenericAvatar (GameObject go, string rootMotionTransformName);

파라미터

go Root object of your transform hierarchy.
rootMotionTransformName Transform name of the root motion transform. If empty no root motion is defined and you must take care of avatar movement yourself.

설명

Create a new generic avatar.

All transforms under the root game object will be part of this generic avatar.

using UnityEngine;
using UnityEditor;

public class Example : MonoBehaviour { void Start() { GameObject activeGameObject = Selection.activeGameObject;

if (activeGameObject != null &amp;&amp; activeGameObject.GetComponent<Animator>() != null) { Avatar avatar = AvatarBuilder.BuildGenericAvatar(activeGameObject, ""); avatar.name = "InsertYourName"; Debug.Log(avatar.isHuman ? "is human" : "is generic");

Animator animator = activeGameObject.GetComponent<Animator>() as Animator; animator.avatar = avatar; } } }