void OnDisable() { if (IKD_CrossPlatformInputManager.AxisExists(horizontalAxisName)) { IKD_CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxisName); } if (IKD_CrossPlatformInputManager.AxisExists(verticalAxisName)) { IKD_CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxisName); } }
void OnEnable() { if (!IKD_CrossPlatformInputManager.AxisExists(axisName)) { // if the axis doesnt exist create a new one in cross platform input m_Axis = new IKD_CrossPlatformInputManager.VirtualAxis(axisName); IKD_CrossPlatformInputManager.RegisterVirtualAxis(m_Axis); } else { m_Axis = IKD_CrossPlatformInputManager.VirtualAxisReference(axisName); } FindPairedButton(); }
IKD_CrossPlatformInputManager.VirtualAxis m_HorizontalVirtualAxis; // Reference to the joystick in the cross platform input void Start() { wheelBeingHeld = false; wheelAngle = 0f; wheelCenter = GetCenter(steeringWheel.rectTransform); wheelPosition = new Rect(wheelCenter.x - (steeringWheel.rectTransform.sizeDelta.x / 2), wheelCenter.y, steeringWheel.rectTransform.sizeDelta.x, steeringWheel.rectTransform.sizeDelta.y); if (!IKD_CrossPlatformInputManager.AxisExists(axisName)) { // if the axis doesnt exist create a new one in cross platform input m_HorizontalVirtualAxis = new IKD_CrossPlatformInputManager.VirtualAxis(axisName); IKD_CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis); } else { m_HorizontalVirtualAxis = IKD_CrossPlatformInputManager.VirtualAxisReference(axisName); } }
void CreateVirtualAxes() { // set axes to use m_UseX = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyHorizontal); m_UseY = (axesToUse == AxisOption.Both || axesToUse == AxisOption.OnlyVertical); // create new axes based on axes to use if (m_UseX) { // m_HorizontalVirtualAxis = new IKD_CrossPlatformInputManager.VirtualAxis(horizontalAxisName); // IKD_CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis); if (!IKD_CrossPlatformInputManager.AxisExists(horizontalAxisName)) { // if the axis doesnt exist create a new one in cross platform input m_HorizontalVirtualAxis = new IKD_CrossPlatformInputManager.VirtualAxis(horizontalAxisName); IKD_CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis); } else { m_HorizontalVirtualAxis = IKD_CrossPlatformInputManager.VirtualAxisReference(horizontalAxisName); } } if (m_UseY) { //m_VerticalVirtualAxis = new IKD_CrossPlatformInputManager.VirtualAxis(verticalAxisName); //IKD_CrossPlatformInputManager.RegisterVirtualAxis(m_VerticalVirtualAxis); if (!IKD_CrossPlatformInputManager.AxisExists(verticalAxisName)) { // if the axis doesnt exist create a new one in cross platform input m_VerticalVirtualAxis = new IKD_CrossPlatformInputManager.VirtualAxis(verticalAxisName); IKD_CrossPlatformInputManager.RegisterVirtualAxis(m_VerticalVirtualAxis); } else { m_VerticalVirtualAxis = IKD_CrossPlatformInputManager.VirtualAxisReference(verticalAxisName); } } }