I need to access the player from inside a prefab to find a component on the player and then use it later.
The script is attached to the prefab. If I try to do this via GameObject and Property, the prefab won't see the reference from the scene.
var player = e.Source?.GameObject; only works for the IPressable interface. I've been looking through the documentation and can't find anything.
Does anyone know how to access the local player?
I ended up doing it like this:
var player = Scene.GetAllComponents<PlayerController>()
.FirstOrDefault( p => !p.IsProxy );I'm not sure if this is the "correct" way, but it works.