Skip to content

Commit

Permalink
fix: added ue version condition for delegate instance type (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
YermekG authored Jan 12, 2024
1 parent aaeedc4 commit f71ab61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions Source/Immutable/Private/Immutable/ImmutableSubsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,13 @@ void UImmutableSubsystem::Deinitialize() {
}

template <class UserClass>
void UImmutableSubsystem::WhenReady(
UserClass *Object, typename FImmutableSubsystemReadyDelegate::FDelegate::
TUObjectMethodDelegate<UserClass>::FMethodPtr Func) {
OnReady.AddUObject(Object, Func);
#if (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1)
void UImmutableSubsystem::WhenReady(UserClass* Object, typename FImmutableSubsystemReadyDelegate::FDelegate::TMethodPtr<UserClass> Func)
#else
void UImmutableSubsystem::WhenReady(UserClass* Object, typename FImmutableSubsystemReadyDelegate::FDelegate::TUObjectMethodDelegate<UserClass>::FMethodPtr Func)
#endif
{
OnReady.AddUObject(Object, Func);
}

void UImmutableSubsystem::OnBridgeReady() {
Expand Down
8 changes: 5 additions & 3 deletions Source/Immutable/Public/Immutable/ImmutableSubsystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ class IMMUTABLE_API UImmutableSubsystem : public UGameInstanceSubsystem {
// Execute a delegate when the subsystem is ready (i.e.: when the browser is
// running and the Immutable SDK game bridge has loaded).
template <class UserClass>
void WhenReady(UserClass *Object,
typename FImmutableSubsystemReadyDelegate::FDelegate::
TUObjectMethodDelegate<UserClass>::FMethodPtr Func);
#if (ENGINE_MAJOR_VERSION >= 5 && ENGINE_MINOR_VERSION >= 1)
void WhenReady(UserClass* Object, typename FImmutableSubsystemReadyDelegate::FDelegate::TMethodPtr<UserClass> Func);
#else
void WhenReady(UserClass* Object, typename FImmutableSubsystemReadyDelegate::FDelegate::TUObjectMethodDelegate<UserClass>::FMethodPtr Func);
#endif

private:
UPROPERTY()
Expand Down

0 comments on commit f71ab61

Please sign in to comment.