Determine "who" presses UI button
Hi all,
Currently trying to make a "PlayerController" script which can take control of a vehicle by right clicking on it, which opens a menu with a unity UI button to "Take Control". I'm mostly prototyping at this point.
So far I can manually assign control of the playercontroller to the vehicle, however to be more rigorous with my code (since I'm prototyping I'd like to have this code be extensible if in the future I make this something with like a co-op function) I'm trying to figure out how to make the vehicle recognize which playercontroller is requesting access.
Essentially, what I want to do is pass the PlayerController component that a "player" is using when pressing the button, so the button recognizes which script is requesting control of the vehicle. I've explored passing parameters to a button, but the menu is a prefab which poses some challenges.
Your answer
Follow this Question
Related Questions
Invisible Buttons 1 Answer
How to move character with UI buttons? 0 Answers
UI text wont highlight 0 Answers
Detecting a button click 1 Answer
How to use UI button in Update()? 1 Answer