- Home /
Question by
justineardiente_unity · Apr 06, 2020 at 03:25 PM ·
unity 5unity 2d
Can someone help me.. I'm trying to use the button it works! but the problem is I can't put limits with the Y position it keeps moving even it reaches the value of minheight and maxheight thanks.
public void Up()
{
Vector3 pos = transform.position;
pos.y = Mathf.Clamp(pos.y, Yaxis , minHeight);
transform.position = pos;
}
public void Down()
{
Vector3 pos = transform.position;
pos.y = Mathf.Clamp(pos.y, minHeight , maxHeight);
transform.position = pos;
}
//That's the Code
Comment
Your answer
Follow this Question
Related Questions
Why I am noticing frame drops during ball movement? 1 Answer
Unity Editor not installing from unity hub.,Unity Editor is not installing from unity hub. 0 Answers
How to create a hero's range of action? 0 Answers
How to use tilemaps? 0 Answers
Can anyone help with loading issues when button is clicked? 0 Answers