I would like to make simple slide menu and simple code but every time I get current Posx from
Update Method , I had got multiple current number of positoin of x
example
Update
//get curent of x Pos
float origin = GroupPanel.transform.localPosition.x;
Debug.Log (origin);
//add new Position
GroupPanel.transform.localPosition = new Vector3 (origin + -676f,0,0);
each column width 676f
If I touch “next” by one time, just one time!
[right to left]
-676f
-1352
-2028
-2704
-3380
this result
The screenshot loads too slowly from that site, you could also upload it to forum post directly.
You didn’t show what “next” does as script. Update() is a function that runs every frame. So the code above is moving GroupPanel.transform.localPosition.x left by 676 every frame. You have no conditions to stop it or something, i don’t know what you intended to do.
Thankyou sir I get the idea.
Can you suggest me how to stop or condition
let me explan more
this is “Next script”
//update script on “Next btn”
void LateUpdate () {
// get touch or key pressing call next column
if(touch or key){
NextPage();
}
}
//Next column ,This is my next condition
if (GroupPanel.transform.localPosition.x >= destiantion) {
GroupPanel.transform.localPosition = new Vector3 (destiantion,0,0);
} else {
GroupPanel.transform.localPosition = new Vector3 (-676f,0,0);
}
“if(touch or key)” This is vague. You need to be specific that you are using them correct way, you might be checking “while touching”, not “when touch goes down”. With keys that difference comes from GetKey() and GetKeyDown.
So all in all if i understand right, you’ll want movement to happen just once when you click next. Then you should move the movement code inside the NextPage() code.