- Home /
Question by
may04_unity · Nov 26, 2020 at 12:51 PM ·
animationmovementarrow
How to fix the arrow movement to a particular object?
Hello, everyone,
I am completely new to Unity. I hope you'll can help me out with this!
I am trying to point an arrow to an object which is trying to show that click this button. In this case, I want to move the arrow back and forth and I have typed in this code
using System.Collections; using System.Collections.Generic; using System.Diagnostics; using UnityEngine;
public class Move : MonoBehaviour {
public float speed = 2;
//use this for intitialization
void Start () {
}
//update is called once per frame
void Update()
{
transform.position = new Vector3(transform.position.x, Mathf.PingPong(Time.time * speed, 5), transform.position.y);
}
}
But when I run the game the arrow is not visible near the object but far away somewhere else. Why is this so?
Comment
Your answer