Version: 2023.2
public static Animations.PropertySceneHandle BindSceneProperty (Animator animator, Transform transform, Type type, string property);
public static Animations.PropertySceneHandle BindSceneProperty (Animator animator, Transform transform, Type type, string property, bool isObjectReference= false);

参数

animator 调用此方法的 Animator 实例。
transform 目标 Transform。
type Component 类型。
property 要绑定的属性。
isObjectReference 如果要绑定的属性会访问诸如 SpriteRenderer.sprite 之类的对象,则需要将 isObjectReference 设置为 true。

返回

PropertySceneHandle 返回表示新绑定的 PropertySceneHandle。

描述

创建一个 PropertySceneHandle,用于表示场景中 Transform 的 Component 属性上的新绑定。

您可以绑定尚不存在的属性。例如,您可以绑定稍后动态添加的 MonoBehaviour 上的属性。在这种情况下,您需要在 GameObject 上添加 MonoBehaviour 后使用 ResolveAllSceneHandles 手动解析句柄。