Question by
LlamaTheHutt · Nov 21, 2016 at 02:34 AM ·
animationbuttonvector3recttransformif
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! :) 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
love-fresh-memes.jpg
(61.6 kB)
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612101055im_/https://answers.unity.com/themes/thub/images/avi.jpg)