How to add Game movement in C# please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to add Game movement in C# please

Keyboard input for Unity Editior or something...

22nd May 2019, 2:03 PM
vizznet
vizznet - avatar
5 Answers
+ 5
VincentDV example: using System.Collections; using System.Collections.Generic; using UnityEngine; public class MYCLASS : MonoBehaviour{ public Rigidbody rigidbody; } void start(){ } //update is called once per frame void FixedUpdate(){ //command creation if (Input.GetKey("A")){ rigidbody.AddForce(0,0,100 * Time.deltaTime); } }
22nd May 2019, 2:28 PM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 5
VincentDV keyboard input in C# for unity (API) https://docs.unity3d.com/ScriptReference/Input.html UNITY TUTORIALS https://learn.unity.com/tutorials keyboard input in C# https://www.sololearn.com/learn/CSharp/2585/ I hope I was helpful
22nd May 2019, 2:17 PM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 4
VincentDV try to assign a event (example: A key down) to a function (example addforce() )
22nd May 2019, 2:23 PM
Alessio Benvenuti
Alessio Benvenuti - avatar
+ 3
Thanks for your help
22nd May 2019, 2:25 PM
vizznet
vizznet - avatar
+ 2
Alessio I mean game movement...
22nd May 2019, 2:22 PM
vizznet
vizznet - avatar