Can we create Shaders or Vertex Factories Type in a Game Project?


I’m trying to create a Vertex Factory via IMPLEMENT_VERTEX_FACTORY_TYPE, the code is located in my game project module, not in the engine module, or a plugin.

As soon as the editor kick off, I’ve got an assertion saying that my module wasn’t loaded soon enough to initialize it’s vertex factory type.

So, is there a way to do that ? Or should I move this in the engine itself ?

Not sure how to do it with a module, but with a plugin you define its LoadingPhase to be PostConfigInit, which will initialise it early enough to allow IMPLEMENT_VERTEX_FACTORY_TYPE. I know this doesn’t answer your question, but will hopefully give you some hints on what to look for, if you do find the answer please share.

Yes, that what I’m actually trying to do now. Anyway, I’d like to know if it’s possible in the game project, so I let the question unresolved.

Okay after doing a bit of testing. You can actually add the following code to your .uproject file:

      "Name" : "<ModuleName>",
      "Type" : "<Whatever>",
      "LoadingPhase" : "PostConfigInit"

So same as the plugin way, but in the .uproject file instead (ModuleName should match the name of your game module).

Usually what you would do though is split up your engine specific stuff (ie. Vertex Factory code and other rendering stuff) into a seperate module and only load that module as PostConfigInit and have your standard game module loaded normally.

Nice, thanks for the tips !
But yes, you right, I feel that it would be cleaner to load the vertex factory code in another module. Hence the plugins.

I don’t know what I’m doing wrong, with my code in a Plugin, set to PostConfigInit LoadingPhase, I got the same error. I’ll try tomorrow to create an entirely new modules and see if it load.