How to use initialized attributes from a plugin?

As part of an ongoing project we have received an implementation in a .lib format and we need to create some Actors in Unreal Editor that inherit from elements of that .lib.

Following the Linking Static Libraries tutorial I have managed to load the module and create those classes.

My problem starts when I load the game after creating the assets:

  • The library has a class named “Model” that manages the elements in it.
  • My game actors, “Child” inherit from a class: “Parent”, “Parent” contains a pointer to “Model”

The library assumes that your instance of “Model” is unique, and my question is: Where can I initialize “Model” so that “Child” classes receive the same instance when they are created?

At the bottom of the tutorial it is mentioned that you can overload the startup of the module to create an initialization of your Game Module. Currently this is my code for the game module load:

class MyModule: public FDefaultGameModuleImpl
{
private:
	Model* model;
public:
	Model* getModelInstance()
	{
		return model;
	}

	virtual void StartupModule() override
	{
		model = new Model(parameter1, parameter2);
	}

};

IMPLEMENT_PRIMARY_GAME_MODULE(MyModule, LibraryName, "LibraryName");

I would like to access the initialized model in my “Child” classes but I do not know how to get access to it.

Thank you in advance!