UnityのStandard Assets – CrossPlatformInputのモバイルスティックが、次のシーンを読み込んだあと動かない場合があったので、以下の方法で解決。
- Standard Assets/CrossPlatformInput/Scripts/Joystick.CSを、以下の部分を修正。
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)
{
if (CrossPlatformInputManager.AxisExists(horizontalAxisName)) {
CrossPlatformInputManager.UnRegisterVirtualAxis(horizontalAxisName);
}
m_HorizontalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(horizontalAxisName);
CrossPlatformInputManager.RegisterVirtualAxis(m_HorizontalVirtualAxis);
}
if (m_UseY)
{
if (CrossPlatformInputManager.AxisExists(verticalAxisName)) {
CrossPlatformInputManager.UnRegisterVirtualAxis(verticalAxisName);
}
m_VerticalVirtualAxis = new CrossPlatformInputManager.VirtualAxis(verticalAxisName);
CrossPlatformInputManager.RegisterVirtualAxis(m_VerticalVirtualAxis);
}
}
△参考
There is already a virtual axis named ‘x’ registered – Unity Answers
http://answers.unity3d.com/questions/1005113/there-is-already-a-virtual-axis-named-x-registered.html