11using System ;
22using System . Collections . Generic ;
33using Unity . MLAgents . Actuators ;
4- using Unity . MLAgents . Extensions . Runtime . Input . Composites ;
54using Unity . MLAgents . Policies ;
6- using UnityEditor ;
75using UnityEngine ;
86using UnityEngine . InputSystem ;
97using UnityEngine . InputSystem . Layouts ;
@@ -39,7 +37,6 @@ public class InputActuator : IActuator, IHeuristicProvider
3937 static Dictionary < InputAction , InputControlLayout > s_InputActionToLayout = new Dictionary < InputAction , InputControlLayout > ( ) ;
4038
4139 readonly PlayerInput m_PlayerInput ;
42- readonly InputActionAsset m_ActionAssetCopy ;
4340 readonly InputActionMap m_DefaultMap ;
4441 readonly BehaviorParameters m_BehaviorParameters ;
4542 readonly Agent m_Agent ;
@@ -57,8 +54,8 @@ public InputActuator(PlayerInput playerInput, BehaviorParameters behaviorParamet
5754 Debug . Assert ( playerInput != null ,
5855 "PlayerInput component is required to use the InputSystemActuator" ) ;
5956 m_PlayerInput = playerInput ;
60- m_ActionAssetCopy = InputActionAsset . FromJson ( m_PlayerInput . actions . ToJson ( ) ) ;
61- m_DefaultMap = m_ActionAssetCopy . FindActionMap ( m_PlayerInput . defaultActionMap ) ;
57+ var actionAsset = m_PlayerInput . actions ;
58+ m_DefaultMap = actionAsset . FindActionMap ( m_PlayerInput . defaultActionMap ) ;
6259
6360 m_BehaviorParameters = behaviorParameters ;
6461 m_Agent = agent ;
@@ -224,8 +221,8 @@ public void ResetData()
224221 public void Heuristic ( in ActionBuffers actionBuffersOut )
225222 {
226223 // Write to actionBuffers
227- int continuousOffset = 0 ;
228- int discreteOffset = 0 ;
224+ var continuousOffset = 0 ;
225+ var discreteOffset = 0 ;
229226 foreach ( var action in m_DefaultMap )
230227 {
231228 InputSystem . QueueDeltaStateEvent ( m_Device . children [ 0 ] , new Vector2 ( 0f , 1f ) ) ;
0 commit comments