Is there an "IF" statement for "RectTransform"?

Okay. My goal: Pause Menu. When I click a button, an image slides from the left using an animation I made. When the image RectTransform reaches these coordinates, access the Animator component and set the animation speed to “0”! I don’t know what kind of method I should be using… but if any help, that would be much appreciated! :slight_smile: Thanks!

This is the problem/method I used:

if (PMAnimEndPos.localPosition == new Vector3 (0, -155, 0))


using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class PauseMenu : MonoBehaviour {

public RectTransform PMAnimEndPos;
public Animator PMAnim;

public void PauseButton () {

    PMAnim.enabled = true;
    
}

void Update () {

    if (PMAnimEndPos.localPosition == new Vector3 (0, -155, 0)) {

        PMAnim.enabled = false;
        PMAnim.speed = (0f);

    }
}

}


Yer boi, MysteriousLlama

There is RectTransform x and y, and there is also RectTransform.rect width, height, and so on. This post may help.