浏览代码

Apply suggestions from code review

Co-authored-by: Mohsen K <mohsen.kamalzadeh@unity3d.com>
/main
GitHub 4 年前
当前提交
bbda605b
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 2
      com.unity.perception/CHANGELOG.md
  2. 4
      com.unity.perception/Documentation~/Randomization/Parameters.md
  3. 2
      com.unity.perception/Editor/Utilities/ParameterUIElementsEditor.cs

2
com.unity.perception/CHANGELOG.md


Added AnimationCurveSampler, which returns random values according to a range and probability distribution denoted by a user provided AnimationCurve.
Added DefaultUIElementsEditor class to allow custom ScriptableObjects to render Parameter and Sampler typed public fields correctly in their inspector windows
Added ParameterUIElementsEditor class to allow custom ScriptableObjects and MonoBehaviours to render Parameter and Sampler typed public fields correctly in their inspector windows.
### Changed

4
com.unity.perception/Documentation~/Randomization/Parameters.md


## Using Parameters outside of Randomizers (ie: in MonoBehaviours and ScriptableObjects)
After adding a public Parameter field to a Monobehavior or ScriptableObject, you may have noticed that the parameter's UI doesn't look the same as it does on when added to a Randomizer. This is because the Inspector UI for most Perception randomization components are authored using Unity's relatively new UI Elements framework, though by default, Unity uses the old IMGUI framework to render default inspector editors.
After adding a public Parameter field to a MonoBehaviour or ScriptableObject, you may have noticed that the Parameter's UI doesn't look the same as it does when added to a Randomizer. This is because the Inspector UI for most Perception randomization components is authored using Unity's relatively new UI Elements framework, though by default, Unity uses the old IMGUI framework to render default inspector editors.
Say you have the following CustomMonoBehaviour that has a public GameObjectParameter field:
```

}
```
To force Unity to use UI Elements to render your CustomMonoBehaviour's inspector window, create a custom inspector for your Monobehaviour by deriving the DefaultUIElementsEditor class like so:
To force Unity to use UI Elements to render your CustomMonoBehaviour's inspector window, create a custom editor for your MonoBehaviour by deriving the ParameterUIElementsEditor class like so:
```
using UnityEditor;

2
com.unity.perception/Editor/Utilities/ParameterUIElementsEditor.cs


namespace UnityEngine.Experimental.Perception.Editor
{
/// <summary>
/// Derive this class to force the Unity Editor to render an Object's default inspector using UIElements
/// Derive this class to force the Unity Editor to render the default inspector using UIElements for an Object that includes a Parameter field.
/// to allow parameter UIs to render properly
/// </summary>
public abstract class ParameterUIElementsEditor : UnityEditor.Editor

正在加载...
取消
保存