- Home /
whay cant i move with this script????
i have tried and tried but i cant get this script to work.
using UnityEngine; using System.Collections;
public class bevegelse : MonoBehaviour {
public float moveSpeed;
public float moveBackSpeed;
void Uptade () {
if (Input.GetButton("Forward")) {
transform.Translate (Vector3.forward * moveSpeed * Time.deltaTime);
}
if (Input.GetButton("Backward")) {
transform.Translate (-Vector3.forward * moveBackSpeed * Time.deltaTime);
}
if (Input.GetButton("Right")) {
transform.Translate (Vector2.right * moveSpeed * Time.deltaTime);
}
if (Input.GetButton("Left")) {
transform.Translate (-Vector2.right * moveSpeed * Time.deltaTime);
}
}
}
i have made inputs that has the same name as in the script but i still cant get it to work.
can someone help me?? thanks
Answer by Endless_Aftermath · Aug 13, 2014 at 09:35 PM
I see 2 problems if this is your actual code from your game. Firstly, you spelled Update wrong, secondly, all of your speeds are zero or aren't assigned.
Answer by TheGH0ST · Aug 13, 2014 at 09:41 PM
fix void Uptade to void Update and this public float moveSpeed = 5; public float moveBackSpeed = 3;
Answer by Rudstu · Aug 13, 2014 at 09:52 PM
thanks, it works now. I only had to change the update, the other values are set in the engine.
Thanks again
Check the question as answered. Good luck on your adventures.
Your answer
![](https://koobas.hobune.stream/wayback/20220613160541im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How To Make GUI Buttons Load/Quit 1 Answer
i need some code suggestions 1 Answer
error cs0120 1 Answer
C# Unity 3D Lock Rotation but allow Rotation of Parent Object 1 Answer