public class Move : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
var character = GameObject.Find ("Character");
var Pos = 0f;
if(Input.GetMouseButtonDown(0))
{
if(Pos == 1f){
character.transform.position = new Vector3(13.41f,2.33f,0f);
Pos -= 1f;
Debug.Log("The Character is now On the Bottom");
}
else if(Pos == 0f){
character.transform.position = new Vector3(13.41f,3.8f,0f);
Pos += 1f;
Debug.Log("The Character is now On the Top");
}
}
}
}
I need help with my script I don’t know why its not working. I want it so when I Left Click the Object moves to Point A If its at Point B Vice versa. This is 2d.