It looks free. It is not.

The problem
This searches the scene every frame.
void Update(){ transform.LookAt(Camera.main.transform);}
Camera.main finds the first enabled camera tagged MainCamera. That is a scene lookup, every frame, per script.
What it costs
Multiply it by scripts and by frames.
| Scripts calling it | Per frame | Per second at 60 FPS |
|---|---|---|
| 1 | 1 lookup | 60 |
| 20 | 20 lookups | 1,200 |
| 200 enemies | 200 lookups | 12,000 |
None of them return a different answer than the first one did.
The fix
Ask once. Keep it.
Camera cam; void Awake(){ cam = Camera.main;} void Update(){ transform.LookAt(cam.transform);}
Awake runs once. After that you are reading a field, which costs nothing.
The catch
Cache it, and know when it dies.
If you load a new scene, the old camera is destroyed and your field points at nothing.
- Scene loads
- the old camera is destroyed
- Your cached field
- now points at nothing
- So
- grab it again, or let a manager own it
Re-grab it after a scene load, or get the camera from a manager that owns it.
The rule
If it searches, keep it out of Update.
- Camera.main
- cache in Awake
- GetComponent
- cache in Awake
- Find anything
- cache, or avoid
Newer Unity caches Camera.main. The habit covers the rest.