Announcement

Collapse
No announcement yet.

StartupModule( ) not getting called

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    StartupModule( ) not getting called

    I have a custom module derived from IModuleInterface. It compiles fine and other modules can access it. However, its StartupModule() is not getting called. I also noticed that FModuleManager::GetModulePointer<FMyModule>("MyModule") is coming back empty. This has me confused why it's acting like a module is some cases, but not in others. Something is missing, but I can't figure out what. Ideas?

    #2
    Sounds strange that it would link and run, but have this problem. All I can think of to suggest is:
    - That you have used the IMPLEMENT_MODULE (or similar) macro in your cpp.
    - That the module is included in the module dependencies list in your build or target script.
    - That you have the signature of the startup method correct (assuming you remember to use the override keyword, this wouldn't need checking).

    If all that is as it should be, try checking the output pane in visual studio on project startup for anything relating to your module.

    Comment


      #3
      It's my first contribution : payback time !! I'm very proud
      The topic is old and probably solved for WHAMMY but it may help someone in the futur.

      I ran into the same issue yesterday.
      I do not pretend to understand why but, obviously, my module were started up by the IHM when the project was loaded. So only once.
      Therefore, the UE_LOG macros I put into StartupModule appears only 1 time, lost into the long list of the initial log messages.

      I first made the checks based on the KAMRANN suggestion : I was correct.
      I then tried to solve the problem with :
      - deleting the "LoadingPhase" : "PreDefault" item into the uplugin file
      - changing the "Type" : "Developer" by "Type" : "Runtime"
      I didn't worked either in my case.

      Conclusion : if you have this problem, it may not have a solution. I mean it is perhaps not possible to have the StartupModule() function called each time you press PLAY.
      But it is not a big issue when you accept this fact.
      In my case :
      - I put the piece of code I needed my module to run at PLAYTIME into a "OnBeginPlay()" play function.
      - I created an hidden actor into the scene which call myModule::Get().OnBeginPlay() into his BeginPlay function.

      It is not very pretty but it is a way when you have not yet (as I'm) a full understanding of UE4 and don't have much time.

      I hope it will help.

      PS : the hidden actor way allows as well to put a tick() function into your module.

      Comment

      Working...
      X