Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Automatic Framework Feature Registration

Dylan Dumesnil edited this page Jun 30, 2020 · 1 revision

Many of MDFramework's features require new nodes to be registered with the MDFramework system. By default MDGameInstance will perform these registrations for you automatically.

There are 2 ways to override that behaviour, the first is to override public virtual bool RequireAutoRegister(); in your GameInstance to return true. This will then check the Node's class's attributes for [MDAutoRegister] before registering. Saving you CPU time from iterating every field on the class when a new node is added.

The second method is to instead give the class you don't want to auto register an attribute:

[MDAutoRegister(MDAutoRegisterType.None)]
public class NodeThatWontRegister : Node
{}

Both these methods will require that you call the registration methods manually:

this.PopulateBindNodes();
this.RegisterReplicatedAttributes();
this.RegisterCommandAttributes();

By default you have to manually register MDCommand using this.RegisterCommandAttributes(); but you can configure a class to auto register everything using

[MDAutoRegister(MDAutoRegisterType.Debug)]
public class NodeThatAutoRegistersEverything : Node
{}

This will autoregister all features, including debug ones like commands.

Clone this wiki locally