Access GameInstance singleton from UMG UUserWidget
We are looking for a way to call functions in our singleton GameInstance from custom UUserWidgets. We currently have a lua state which is created in the GameInstance that we need to access statically from our game interface to pass function calls to Lua. As UUserWidgets are not actors we cannot use GetGameInstance() to reference the GameInstance.
Is there an alternative to passing in/spawning an Actor and taking the game instance form that? Or is there a better alternative to create a singleton in which to create our Lua state, which can have functions called in it by UUserWidgets statically.
asked Jun 10 '15 at 12:02 AM in C++ Programming
you could try accessing it from
This static function needs a world context object in order to recover the world's game instance. you could try something like:
as UUserWidget has a GetWorld() method. You could even try this:
Hope this helps.
Follow this question
Once you sign in you will be able to subscribe for any updates here