Forum rules - please read before posting.

Subclassing some AC components

I noticed some AC components (like for example PlayerInput) have a lot of protected members. If I make a subclass of it, is there a recommended way to tell AC to use it instead of the default implementation?
Thanks

Comments

  • edited May 2023

    It depends on which in particular you want to override.

    Marking the original script's functions as virtual is the easiest way - but there's a potential performance impact for commonly used functions.

    In what way are you looking to override PlayerInput's functionality? The provided way is to rely on input override delegates, as outlined in the Manual's "Remapping inputs" chapter.

  • I managed to fix my particular issue without subclassing, but mostly I was curious as I saw a lot of members were protected and some member were virtual.
    It adds great flexibility that they can be subclassed, but I'm curious how one should tell AC to use the subclass. Maybe the properties in Kickstarter could expose a setter as well so folks like me could set their own subclass in its place during some initialization step?

  • Having your own subclasses replace defaults should just be a case of replacing them manually in the GameEngine or PersistentEngine - once present, the usage should be automatic.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.