i want to ask why the script(camera inputs) block raycast on android ?
Android and mouse input
and do we have solutions ?
Hi, did you notice the issue building my demo scenes for android? Can you tell me which demo scene exactly? Thanks
On the InputTouch component, can you make sure to uncheck the "useMouse" option? Let me know if that solved the issue.
Anthony
i cant select any object in the scenes
Anthony
i did but the script camera Inputs blocks the raycast i cant select the objects on my android phone
so i dont know what is the problem
can i use any script or component to do my raycast without blocking
my game works well on pc but on android i cant select the objects on the scene
What is the method you are using to select objects on your scene? Can you share a small unitypackage with a demo scene (without the Exoa folder) so I can investigate?
if (Input.GetMouseButtonUp(0))
{
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast(ray, out hit, Mathf.Infinity))
{
// this part of code is not working(on android) when the script "camera inputs" is active ...
// when i remove this script or deactivated , the code work normally on android
}
}
helloooooo !!!!!
ya alo
so i can now write a very bad review thank you for your support
mohammadJJJ Hi, I do my best to provide support when I can, you don't need to blackmail developers.
have you tried to debug the code you shared, to see if the Input.GetMouseButtonUp() was working, or if it's the raycast that doesn't return anything?
On mobile devices you should not use Input.GetMouseButtonUp() and mousePosition, but rather Touch.GetTouch()
I just tried this code instead of the mouse input version, and it works perfectly:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class AndroidTest : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
void Update()
{
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
{
Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(0).position);
if (Physics.Raycast(ray, out RaycastHit hit, Mathf.Infinity))
{
Debug.DrawRay(ray.origin, ray.direction * 10, Color.green, 5f);
Debug.Log("AndroidTest hit:" + hit.collider.name);
}
}
}
}