Hello all,
I’m trying to unspaghetify my code, and I’ve decided to migrate my input system into using the new input system. I looked at some tutorials, and found that I have to create an instance of the Input Action Asset Class in order to subscribe my methods to its events like so:
private PlayerInputAction playerInput;
void Awake()
{
playerInput = new PlayerInputAction();
}
void OnEnable()
{
playerInput.Enable();
//more subscribing stuff here
}
The problem is though, I have several other scripts that need input such as with animation, physics, and secondary player actions. I don’t want to combine them into one script either. Is it okay if all of these separate scripts create an instance of the PlayerInputAction class on their own? If not, is there a way for me to be able to subscribe my methods to the events without creating a new instance?
I apologize in advance if this seems like a silly question, I am quite new to OOP in general. Thanks!