So I have a Menu Scene where The player can choose what to do next.
The problem is that in this mEnu Scene I have an EventSystem with several buttons…In case he Player hits the Play Button he switches to the Game Scene and the Game starts!
At this point I get the problem: There is already a virtual axis named Horizontal registered.
UnityEngine.Debug:LogError(Object)
On the GameScene I have an EventSystem too where I move the character with a Joystick!
Replace this function with your function of same name.
public void RegisterVirtualAxis(CrossPlatformInputManager.VirtualAxis axis)
{
// check if we already have an axis with that name and log and error if we do
if (m_VirtualAxes.ContainsKey(axis.name))
{ //Debug.LogError(“There is already a virtual axis named " + axis.name + " registered.”);
m_VirtualAxes.Remove(axis.name);
m_VirtualAxes.Add(axis.name, axis);
if (!axis.matchWithInputManager)
{
m_AlwaysUseVirtual.Add(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);
}
}
}