MonoBehaviour vs ScriptableObjects & events based communication


I’m just starting the Basic Combat section where we are separating the control layer for our player.

I’ve got 2 different questions…

  1. Would it make sense to have an InputManager that would be only responsible to raycast, see what layer/tags has been hit and trigger appropriate events (OnTerrainClick, OnEnnemyClick, etc) ?
    Isn’t it easier later on to debug / improve (like the order of importance of layers) as all the inputs would be managed within the same class ?

  2. Would it make senses to create a “CharacterController” that would rely on an abstract “CharacterMovement” that would be ScriptableObjects and not MonoBehaviours as the movement itself isn’t really a component but a part of a component (the component here being the whole character control) ? I’m not sure tho that the ScriptableObjects have really been done for that but those would allow to have encouter specific movement script that just have to be associated to the CharacterController right ?

As much as we’ll be using ScriptableObjects through this course, we’re not not using them for player input. Interestingly enough, now that the new Unity Input System is no longer a moving target, it is a system that relies on ScriptableObjects to define input events. I’m sure that in future courses, we will be doing more with this input system, but at the time the Core Combat course was created, the system was barely in beta, and looked nothing like it does now.

In terms of input managers, I believe you’ll find that by the time we’re done with the Core Combat course, you’ll see how the system we’re building comes together.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms