For example, I have a base class for a component called Ship
, and a subclass called BigShip
.
My current situation is I have a player that has a void OnTriggerEnter (Collider other)
entering a ship. This player needs to have access to the ship component that exists in other
.
The best way I can think of getting the component is to iterate over all of the components and (somehow) individually check if each Component is a subclass of Ship
.
What’s the best way of doing this?