言語: 日本語
  • C#
  • JS
  • Boo

スクリプト言語

お好みのスクリプト言語を選択すると、サンプルコードがその言語で表示されます。

AvatarBuilder.BuildGenericAvatar

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Sumbission failed

For some reason your suggested change could not be submitted. Please try again in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

public static function BuildGenericAvatar(go: GameObject, rootMotionTransformName: string): Avatar;
public static Avatar BuildGenericAvatar(GameObject go, string rootMotionTransformName);
public static def BuildGenericAvatar(go as GameObject, rootMotionTransformName as string) as Avatar

Parameters

go Transform 階層のルートオブジェクト
rootMotionTransformName Transform の Transform 名。もし空の場合ルートモーションは定義されずアバターの動作に自身で対応させる必要があります。

Description

新規のジェネリック アバターを作成します。

全ての ルート ゲームオブジェクトの配下の Transform はこのジェネリックアバターの一部となります。

function Start() {
	var go: GameObject = Selection.activeGameObject;
	
	if (go != null && go.GetComponent("Animator") != null) {
		var avatar: Avatar = AvatarBuilder.BuildGenericAvatar(go, "");
		avatar.name = "Bob";
		Debug.Log(avatar.isHuman ? "is human" : "is generic");
	
		var animator: Animator = go.GetComponent("Animator") as Animator;
		animator.avatar = avatar;
	}
}