2月 252021
原因としては、Active(true) と Active(false) を繰り返すとVirtual Joystick が使えなくなる
There is already a virtual axis named Horizontal1 registered.
UnityEngine.Debug:LogError(Object)
UnityStandardAssets.CrossPlatformInput.VirtualInput:RegisterVirtualAxis(VirtualAxis) (at Assets/Standard Assets/CrossPlatformInput/Scripts/VirtualInput.cs:39)
UnityStandardAssets.CrossPlatformInput.CrossPlatformInputManager:RegisterVirtualAxis(VirtualAxis) (at Assets/Standard Assets/CrossPlatformInput/Scripts/CrossPlatformInputManager.cs:59)
UnityStandardAssets.CrossPlatformInput.Joystick:CreateVirtualAxes() (at Assets/Standard Assets/CrossPlatformInput/Scripts/Joystick.cs:64)
UnityStandardAssets.CrossPlatformInput.Joystick:OnEnable() (at Assets/Standard Assets/CrossPlatformInput/Scripts/Joystick.cs:30)
UnityEngine.GameObject:SetActive(Boolean)
MainControl:onClickVr() (at Assets/_main/MainControl.cs:353)
UnityEngine.EventSystems.EventSystem:Update() (at /Applications/Unity/Hub/Editor/2019.4.20f1/Unity.app/Contents/Resources/PackageManager/BuiltInPackages/com.unity.ugui/Runtime/EventSystem/EventSystem.cs:377)
とりあえずの対処
public void RegisterVirtualAxis(CrossPlatformInputManager.VirtualAxis axis)
{
// Modified By M.Hotaka
// check if we already have an axis with that name and log and error if we do
if (m_VirtualAxes.ContainsKey(axis.name))
{
Debug.Log("There is already a virtual axis named " + axis.name + " registered.");
UnRegisterVirtualAxis(axis.name);
}
// else
{
// add any new axes
m_VirtualAxes.Add(axis.name, axis);
// if we dont want to match with the input manager setting then revert to always using virtual
if (!axis.matchWithInputManager)
{
m_AlwaysUseVirtual.Add(axis.name);
}
}
}