Animation not working on Oculus Quest

In unity everything works fine. My character walks up to a point and then I use animationComponent.Play to change the animation but when I build and run on the Oculus Quest, the character just keeps on walking. It doesn’t change the animation like it does inside Unity. Can anybody help?

1 Like

There’s nothing Quest-specific when it comes to animation. You’ll need to provide a lot more detail than that to get any help, I think.

That’s why it’s so weird. When I run it in unity everything works fine and then I build it and run it on the Quest and the animation change just doesn’t happen. Apart from that everything acts as supposed to. I’m sorry if I don’t have any more detail, I can’t even guess what could be the issue, I’m fairly new to unity and oculus development.

However, could it be something like that the script handling the animation change doesn’t convert or gets included in the build or something like that? Because one thing I noticed is that when I have visual studio open and try to hit play, unity crashes. But when I close visual studio and hit play it works. That didn’t happen when I didn’t have the OVRCameraRig. Could that mean that the script is corrupt in some way?

Here is the script. I don’t know if it helps with detail, but anyway.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ChangeAnimation : MonoBehaviour
{
    public WaypointMover waypointMover;
    public AnimationClip newAnimation;
    Animation animationComponent;
    private Vector3 charPos;
    private Vector3 pointPos;
    private Vector3 pointPos2;


    void Start()
    {
        if (!waypointMover)
        {
            waypointMover = GetComponent<WaypointMover>();
            animationComponent = GetComponent<Animation>();
        }
        pointPos = GameObject.Find("_waypoint (2)").transform.position;
    }

    private void Update()
    {
        charPos = GameObject.Find("woman_1046").transform.position;
        pointPos = GameObject.Find("_waypoint (2)").transform.position;
        pointPos2 = GameObject.Find("_waypoint (6)").transform.position;

        if (Vector3.Distance(charPos, pointPos) >= 1 && (Vector3.Distance(charPos, pointPos2) >= 1))
        {
            animationComponent.Play("walk");
        }
    }


    void ChangeAnim ()
    {
        charPos = GameObject.Find("woman_1046").transform.position;
        pointPos = GameObject.Find("_waypoint (2)").transform.position;
        pointPos2 = GameObject.Find("_waypoint (6)").transform.position;

        if (Vector3.Distance(charPos, pointPos) <= 1)
        {
            animationComponent.PlayQueued("Looking_around", QueueMode.PlayNow);
            animationComponent.PlayQueued("Use_object", QueueMode.CompleteOthers);
        }

        if (Vector3.Distance(charPos, pointPos2) <= 1)
        {
            animationComponent.PlayQueued("Looking_around", QueueMode.PlayNow);
            animationComponent.PlayQueued("Use_object", QueueMode.CompleteOthers);
        }
    }
}

Did you find a solution to this? The same is happening to me, animation doesn’t work on build

Make a new post instead of reviving an old one.
And make sure everything is updated before making one

there is no conditional logic that calls ChangeAnim()…anywhere in the update/fixed update method.
Try moving any conditional logic to the update method, and call your change function in the game loop.

This is a code error and that ‘animation function’ will never be called, even in the editor, until you call it.
ie…

    private void Update()
    {
        charPos = GameObject.Find("woman_1046").transform.position;
        pointPos = GameObject.Find("_waypoint (2)").transform.position;
        pointPos2 = GameObject.Find("_waypoint (6)").transform.position;
        if (Vector3.Distance(charPos, pointPos) >= 1 && (Vector3.Distance(charPos, pointPos2) >= 1))
        {
            animationComponent.Play("walk");
        }
// HERE - CALL THE ACTUAL Function, and pass the values ONCE..see you are already looking the same values up in update!!
        else
    {
        ChangeAnim(charPos,pointPos,pointPos2);
     }
void ChangeAnim (Vector3 charPos,Vector3 pointPos, Vector3 pointPos2)
  {
        if (Vector3.Distance(charPos, pointPos) <= 1)
        {
            animationComponent.PlayQueued("Looking_around", QueueMode.PlayNow);
            animationComponent.PlayQueued("Use_object", QueueMode.CompleteOthers);
        }
        if (Vector3.Distance(charPos, pointPos2) <= 1)
        {
            animationComponent.PlayQueued("Looking_around", QueueMode.PlayNow);
            animationComponent.PlayQueued("Use_object", QueueMode.CompleteOthers);
        }
  }