Log in or register to post comments

Raycast not working on Android Device

January 21, 2020 - 10:41am #1



I do have a big problem with Raycast on Android Build.


In my project im using the camera center to aim on a projected 3d model. when using input touch on my device screen it should trigger several actions.

On Unity Editor when using my webcam and mouseclicks instead it works all fine. All the elementnames get recognized correctly and the sound plays when hitting the object.

When building the project for my Android device its not working at all. By chance i get an hit on the biggest element but not on the small ones.

Additionally the hit on the biggest 3d element doesnt work how it should. It only works sometimes at a special distance although the raycast distance is set to infinity and it also gets triggered when aiming next to the element where it should NOT work since the element isnt placed on that position. I sometimes hit the object when aiming somewhere else.

All my elements have colliders on it.

I am using Unity 2018.4.14f1 (64-bit).


Im tried to use the default code from the Unity manuals for InputTouch and InputMouse. Neither nor is working and so does all the rest i found in several threads.

Im am totally desperate of not getting this fixed since my deadline is coming closer and closer....


I would appreciate any kind of hint on how to fix this issues.


Thanks alot so far

Raycast not working on Android Device

January 25, 2020 - 9:19am #3



As i said running my applikation in the editor works perfectly fine, still!


I found out that if i build the android version and run it on my xiaomi android device that on runtime the Button cubes (See image attached) on the left invisibly move back to the center of my first imagetarget although they have never been there. This means that if i touch hit this position on my android device i get a hit but not when i hit the actual 3d model seen on the side of the map.


The button cubes are not getting moved to the place seen on the image during runtime. They are set to this position in the scene. The yellow Pins centered are repositioned during runtime to their special spots. They are not touchable at all in the android version, not even on wrong positions.


I am trying to fix this issue for weeks now and would appreciate any kind of hint that could possibly help me.



Image icon unity_Raycast_bug.PNG1.17 MB

Raycast not working on Android Device

January 24, 2020 - 4:34pm #2

Anyone with any advice??

Log in or register to post comments