I so badly want to make a game with blockland features in Unity 5 c#. I kept searching for so many months. And now I finally played the Blockland game Tutorial; And found out the movements of Numpad keys of 8,4,6 and 2 move lateral? I google search for this but can’t find it for Unity 5 c#? Do you guys know how to make a GameObject move lateral with numpad keys 8,4,6 and 2 in Unity 5 c#?
Here is a example of the game of the game I was playing for references. Not my game some one else’s game.
(((Solved)))
heres the code:
public class MoveCubeFPSMovement : MonoBehaviour
{
[SerializeField] public float FPSCubeMovement = 1.0f;
[SerializeField] public Transform target;
[SerializeField] public float angle1 = 0.0f;
[SerializeField] public float angle2 = 179.9f;
private void Awake()
{
angle1 = 0.0f;
angle2 = 179.9f;
}
void Update ()
{
Vector3 targetDir = target.position - transform.position;
float angle1 = Vector3.Angle (targetDir, transform.forward);
float angle2 = Vector3.Angle (targetDir, transform.right);
if (Input.GetKeyDown (KeyCode.Keypad8))
{
if (angle1 >= 135.0f )
{
Debug.Log ("FPS cube moved forward");
transform.position += transform.forward * FPSCubeMovement;
}
if (angle1 <= 45.0f )
{
Debug.Log ("FPS cube moved backward");
transform.position -= transform.forward * FPSCubeMovement;
}
if (angle2 >= 135.0f )
{
Debug.Log ("FPS cube moved right");
transform.position += transform.right * FPSCubeMovement;
}
if (angle2 <= 45.0f )
{
Debug.Log ("FPS cube moved left");
transform.position -= transform.right * FPSCubeMovement;
}
}
if (Input.GetKeyDown (KeyCode.Keypad2)) {
if (angle1 >= 135.0f) {
Debug.Log ("FPS cube moved forward");
transform.position -= transform.forward * FPSCubeMovement;
}
if (angle1 <= 45.0f) {
Debug.Log ("FPS cube moved backward");
transform.position += transform.forward * FPSCubeMovement;
}
if (angle2 >= 135.0f) {
Debug.Log ("FPS cube moved right");
transform.position -= transform.right * FPSCubeMovement;
}
if (angle2 <= 45.0f) {
Debug.Log ("FPS cube moved left");
transform.position += transform.right * FPSCubeMovement;
}
}
if (Input.GetKeyDown (KeyCode.Keypad4)) {
if (angle1 >= 135.0f) {
Debug.Log ("FPS cube moved forward");
transform.position -= transform.right * FPSCubeMovement;
}
if (angle1 <= 45.0f) {
Debug.Log ("FPS cube moved backward");
transform.position += transform.right * FPSCubeMovement;
}
if (angle2 >= 135.0f) {
Debug.Log ("FPS cube moved right");
transform.position += transform.forward * FPSCubeMovement;
}
if (angle2 <= 45.0f) {
Debug.Log ("FPS cube moved left");
transform.position -= transform.forward * FPSCubeMovement;
}
}
if (Input.GetKeyDown (KeyCode.Keypad6)) {
if (angle1 >= 135.0f) {
Debug.Log ("FPS cube moved forward");
transform.position += transform.right * FPSCubeMovement;
}
if (angle1 <= 45.0f) {
Debug.Log ("FPS cube moved backward");
transform.position -= transform.right * FPSCubeMovement;
}
if (angle2 >= 135.0f) {
Debug.Log ("FPS cube moved right");
transform.position -= transform.forward * FPSCubeMovement;
}
if (angle2 <= 45.0f) {
Debug.Log ("FPS cube moved left");
transform.position += transform.forward * FPSCubeMovement;
}
}
}
}

I forgot to add the explanation, I edited it on. Basically, when you pass in "this" as a parameter, it's an Extension. Otherwise it's just referring to the current class's instance. edit: Then I forgot to answer your immediate question: When "this" is used as a parameter while extending a class, then yes, it should be static. And this would go for all types. This is because you are not modifying the original class, but simply non-destructively extending it.
– rysan007