Raycast doesn't work on Android(cardboard VR), but works in editor.

Hi, I’m stuck for three days now and I really need your help guys.

So the problem is that, raycast doesn’t work on android(samsung s6) but works in editor(using Unity 5.2.3f1, and tried 5.2.2f1), so I can’t solve it myself. Am I missing any option that has to be set? or is my code the problem? It used to work, but I believe I updated Unity and Carboard SDK and Simple code like this doesn’t work anymore. I don’t think it’s problem of cardboard sdk, I tried setup a simple camera to shoot ray at gameobject and still didn’t work.

RaycastHit hit;

// Update is called once per frame
void Update () {
    Debug.DrawRay(gameObject.transform.position, gameObject.transform.forward * 10);
    
    Physics.Raycast(gameObject.transform.position, gameObject.transform.forward, out hit);
    if (hit.collider.tag == "target")
    {
        hit.collider.transform.Rotate(0, 90*Time.deltaTime, 0);
    }
}

There seems to be a bug with Unity, where if the editor is not visible on your computer, and you are running the game on your phone and they are linked, then no graphical changes actually happen on the phone. Maybe that is your issue?

Can’t really tell mate, It’s must be Unity’s bug. Don’t know what it is, but the bug has something to do with physics, no collisions worked also in Android build. They weren’t linked.

@Evaldas Hello. Same problem. Any luck solving it?

I just ran into into this bug in Unity 2018 and 2019. If you have multiple EventSystem scripts in your scene. It confuses the VR Event system and the whole thing just stops working. It also breaks in the editor after you do an android build and it will stay broken until you reload your scene.

I’m replying to an old issue as this was high in my google search results and there are very few other results. Hopefully this will help a couple of people.