Best way to find which player is 'my' player in scene?
I need a way to find which player in the scene is 'my' player when clicking a button on a user interface. I can't use 'hasInputAuthority' directly because the script is running on the UI and not the player object.
The only way I can think of is to search through every player object in the scene and check which one 'hasInputAuthority', but this seems a very inefficient way of doing it, especially if there are a lot of players in the scene. Is there a better way?
Edit: To clarify a bit, I want to perform an action on 'my' player when clicking the UI button. For example, changing clothes. I'm thinking RPC is the way to go with this but I'm still not sure how to call it since I don't have an instance of 'my' player object.
Update: I have now also tried:
NetworkObject player = runner.GetPlayerObject(runner.LocalPlayer);
But this just returns null.