请帮忙。 Unity3D中存在标准资产脚本的问题。 即在VirtualInput.cs
中在Internet上,有其他版本的Unity3D上的代码更正的答案。 这是另一种方法
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.");
}
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);
}
}
}
答案 0 :(得分:0)
我找到了解决问题的方法,并重新制作了方法:
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);
}
}
}