hammurabi_games
New member
Hi. I'm trying to make a multiplayer fps shooter game. I use opsive character controller and ads-on.
Setup the virtual controller to demo scene, the PunVirtualControlsManager. Added virtual contols buttons to canvas but it didnt work. I couldnt see on android deviece.
I tried to test on unity editor and set comment line (line 68) from unityinput.cs
I couldn't see on unity editor too. Debugged to .cs and i saw the FindObjectOfType<VirtualControlsManager>(); was null. Then i debugged the VitualControlsManager.cs and saw conflict because of VirtualControlsManager deactive yourself before FindObjectOfType.
After set commet this line too i saw the virtual contollers. When i seacrhing for why, i found it at UnityInput.cs > LateUpdate() > line 129 , if condition (!m_UseVirtualInput). I changed it to (m_UseVirtualInput) and now it works.
Did i do something wrong?
Setup the virtual controller to demo scene, the PunVirtualControlsManager. Added virtual contols buttons to canvas but it didnt work. I couldnt see on android deviece.
I tried to test on unity editor and set comment line (line 68) from unityinput.cs
Code:
#if !UNITY_EDITOR && (UNITY_IPHONE || UNITY_ANDROID || UNITY_WP_8_1 || UNITY_BLACKBERRY)
if (m_ForceInput != ForceInputType.Standalone) {
var virtualControlsManager = FindObjectOfType<VirtualControlsManager>();
m_UseVirtualInput = virtualControlsManager != null;
}
#endif
I couldn't see on unity editor too. Debugged to .cs and i saw the FindObjectOfType<VirtualControlsManager>(); was null. Then i debugged the VitualControlsManager.cs and saw conflict because of VirtualControlsManager deactive yourself before FindObjectOfType.
Code:
protected virtual void Awake()
{
m_GameObject = gameObject;
if (m_Character == null) {
var camera = UnityEngineUtility.FindCamera(null);
if (camera != null) {
m_CameraGameObject = camera.gameObject;
EventHandler.RegisterEvent<GameObject>(m_CameraGameObject, "OnCameraAttachCharacter", OnAttachCharacter);
}
} else {
var character = m_Character;
m_Character = null; // Set the character to null so the assignment will occur.
OnAttachCharacter(character);
}
m_GameObject.SetActive(false);
}
After set commet this line too i saw the virtual contollers. When i seacrhing for why, i found it at UnityInput.cs > LateUpdate() > line 129 , if condition (!m_UseVirtualInput). I changed it to (m_UseVirtualInput) and now it works.
Did i do something wrong?