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?
↧