Download com.unity.ml-agents/Editor/RenderTextureSensorComponentEditor.cs from ashish2244/ppo-SnowballTarget: direct link, hf CLI and curl.
- Browser
- Download file 1.5 kB
-
https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/com.unity.ml-agents/Editor/RenderTextureSensorComponentEditor.cs
- Command line
-
hf download hf://ashish2244/ppo-SnowballTarget/com.unity.ml-agents/Editor/RenderTextureSensorComponentEditor.cs
-
curl -L -o RenderTextureSensorComponentEditor.cs https://huggingface.co/ashish2244/ppo-SnowballTarget/resolve/main/com.unity.ml-agents/Editor/RenderTextureSensorComponentEditor.cs
1.5 kB
| using UnityEditor; | |
| using Unity.MLAgents.Sensors; | |
| namespace Unity.MLAgents.Editor | |
| { | |
| [] | |
| [] | |
| internal class RenderTextureSensorComponentEditor : UnityEditor.Editor | |
| { | |
| public override void OnInspectorGUI() | |
| { | |
| var so = serializedObject; | |
| so.Update(); | |
| // Drawing the RenderTextureComponent | |
| EditorGUI.BeginChangeCheck(); | |
| EditorGUI.BeginDisabledGroup(!EditorUtilities.CanUpdateModelProperties()); | |
| { | |
| EditorGUILayout.PropertyField(so.FindProperty("m_RenderTexture"), true); | |
| EditorGUILayout.PropertyField(so.FindProperty("m_SensorName"), true); | |
| EditorGUILayout.PropertyField(so.FindProperty("m_Grayscale"), true); | |
| EditorGUILayout.PropertyField(so.FindProperty("m_ObservationStacks"), true); | |
| } | |
| EditorGUI.EndDisabledGroup(); | |
| EditorGUILayout.PropertyField(so.FindProperty("m_Compression"), true); | |
| var requireSensorUpdate = EditorGUI.EndChangeCheck(); | |
| so.ApplyModifiedProperties(); | |
| if (requireSensorUpdate) | |
| { | |
| UpdateSensor(); | |
| } | |
| } | |
| void UpdateSensor() | |
| { | |
| var sensorComponent = serializedObject.targetObject as RenderTextureSensorComponent; | |
| sensorComponent?.UpdateSensor(); | |
| } | |
| } | |
| } | |