Unity cheat sheet

Or just “refresh my memory sheet”

Monobehaviour

Always a component of a gameobject.

Comfusingly these event methods aren’t override, they’re just kinda there.

To make a field writable from the editor (allows “dependency injection”) make a field in the c# class and annotate it with [SerializeField].

“New input system”

The old one was apparently hot garbage. The new one is an (enabled-by-default) package. Everything is under using UnityEngine.InputSystem.

InputActionAsset. One always seems to be pre-created. Can edit with the nice gui. One asset can be set as the project-wide input actions, which makes it globally accessible from code at InputSystem.actions.

They contain action maps, each action map contains InputActions.

making a wasd action:

making a look action: