I'm currently working on a system for the player to switch between different vehicles. When the player moves inside the trigger collider and presses a button, they become a child of the vehicle, the movement script on the player is disabled, and the vehicle's movement script is enabled.
My problem is that my VehicleManager script only knows what the movement script on the vehicle is if I use the GetComponent function and physically type in the name of the script. In what way could I have the VehicleManager figure out which movement script is attached to each different vehicle?
↧