121
NGUI 3 Support / Re: Permanent Button-Action
« on: January 10, 2013, 11:03:33 AM »
Hm. Now you mentioned it, it comes to my mind:
i have three different Movement-Buttons (Left, Right, Jump). I copy&pasted the code in order to make a seperate MoveLeft-Scipt and changed the variables (in order to make him move left actually
) and another to make him jump.
They have all the same structure.
And in OnPress(bool isDown) I check if it is pressed and set the buttonDown Variable to "true" so Update() can does its job.
Could that cause any problems? I tested it in the editor and the device and i didn't get strange behaviour (yet...
).
i have three different Movement-Buttons (Left, Right, Jump). I copy&pasted the code in order to make a seperate MoveLeft-Scipt and changed the variables (in order to make him move left actually
) and another to make him jump. They have all the same structure.
- void Start ()
- {
- knightObject = GameObject.FindGameObjectWithTag("Player");
- KnightShape = knightObject.GetComponent<FSBodyComponent>().PhysicsBody;
- KnightShape.FixedRotation = true;
- velocity = KnightShape.LinearVelocity;
- buttonDown = false;
- }
And in OnPress(bool isDown) I check if it is pressed and set the buttonDown Variable to "true" so Update() can does its job.
Could that cause any problems? I tested it in the editor and the device and i didn't get strange behaviour (yet...
).









