Download

Reworking delegates into BPs

I would like to rework the following FDelegateHandles into my BP only project, can I even do it for the following calls:

LoginChangedHandle = FCoreDelegates::OnUserLoginChangedEvent.AddUObject(this, &UGenMobileGameInstance::OnLoginChanged);
EnteringForegroundHandle = FCoreDelegates::ApplicationHasEnteredForegroundDelegate.AddUObject(this, &UGenMobileGameInstance::OnEnteringForeground);
EnteringBackgroundHandle = FCoreDelegates::ApplicationWillEnterBackgroundDelegate.AddUObject(this, &UGenMobileGameInstance::OnEnteringBackground);
ViewportHandle = FViewport::ViewportResizedEvent.AddUObject(this, &UGenMobileGameInstance::OnViewportResize_Internal);

I really just want to access these four callbacks in any way… if there are any hacky ways to do this that’d work too.

Thanks in advance.

No way to do this? I think the viewport resize callback can’t be done in BP and has to be a tick event.

If there is no way to get callbacks for enteringforeground and enteringbackground (I think I won’t need LoginChanged after all) - how does UE handle this by default? Does one have to think about this when developing for mobile?

Thanks.

“BP only project” is not a good idea. In my opinion you should never create such a project, only C++ ones even if you do 99% of the work in blueprint, at least you can be saved by some C++ when needed.

You can use UApplicationLifecycleComponent for ApplicationHasEnteredForegroundDelegate and ApplicationWillEnterBackgroundDelegate. Not sure about the other two there may be existing BP equivalents already, if not you can still write your own.

Ah nice! Thanks a lot!

@eyoli And yes, I had my project as a C++ project and came across compile issues I couldn’t work around… wasn’t a big deal to go to BPs instead as my project is small. I was also wanting to be able to deploy easier to mobile. I guess now if I have to go back to C++ it’ll be an easier conversion (actually c++ to BP is a pain in the bum generally speaking), we’ll see if I need to. My C++ skills aren’t super sharp either.