Quantcast
Viewing latest article 17
Browse Latest Browse All 41

Reference to a general type of script independent of its class name

I want to have a class to reference a script, but that script is not the same every time. For example: public class PlayerController : MonoBehaviour { public InputActions inputActions; public MonoBehaviour jumpController; private void Awake() { inputActions.PlayerActions.Jump.performed += context => jumpController.Jump(); } } I have 3 classes for JumpController (with differents class names) that implement the same methods (same names) but in differents ways. I want to switch in the inspector between these classes without change the code in the PlayerController class. The problem is that I can't access to a script methods without specificing his exact name. Is there a way to accomplish this?

Viewing latest article 17
Browse Latest Browse All 41

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>