UNITY ExposedReference 设置

2020-04-11  本文已影响0人  多罗猫_游戏人

ExposedReference 是Unity在运行时被创建的可解析的通用引用,一般用于对场景物体的引用.
例如[ScriptableObject][PlayableAsset],在Timeline TimelineClip 的数据引用中被使用。
1.设置Value
1.没有初始化的ExposedReference,其exposedName 为空,没有被分配名字,需要我们手动分配名字
【类似 Key Value,如果不分配名字直接赋值,会导致大家都使用一个Key,一个Value,还无法修正】

ExposedReference.exposedName = UnityEditor.GUID.Generate().ToString();
myPlayableDirector.SetReferenceValue(ExposedReference.exposedName, Value);

2.通过UnityEditor 的serializedProperty 直接赋值,会自动生成exposedName(只在UnityEditor 编辑器面板中使用)

serializedProperty  property= serializedObject.FindProperty("ExposedReference Name");
property.serializedReferenceValue = Value;

2。获得Value [Timeline等 Playable框架]

  1.ExposedReference.Resolve(graph.GetResolver()); 
  2.Value =myPlayableDirector.GetReferenceValue(ExposedReference.exposedName);

链接
https://forum.unity.com/threads/set-exposedreference-t-value.470978/
https://forum.unity.com/threads/set-exposedreference-t-value.470978/
[https://docs.unity3d.com/ScriptReference/SerializedProperty.html][http://resetoter.cn/UnityDoc/ScriptReference/ExposedReference_1.html]
https://gameinstitute.qq.com/community/detail/127401

上一篇下一篇

猜你喜欢

热点阅读