This is my GameInstance class.
void UTLPGameInstance::ConnectToGameSparksService() { GSObj = NewObject<UGameSparksObject>(this, UGameSparksObject::StaticClass()); GSMessageListener = NewObject<UGSMessageListenersObject>(this, UGSMessageListenersObject::StaticClass()); GSObj->Disconnect(); GSObj->OnGameSparksAvailableDelegate.AddDynamic(this, &UTLPGameInstance::OnGameSparksAvailable); GSObj->Connect("m368503MEbSG", "YUZNsgNGuTZyXjCVeYnRR0PTlj7FKqxs", true, false); } void UTLPGameInstance::SetGameSparksServiceInterface(IGameSparksServiceInterface * GameSparksServiceInterface) { this->GameSparksServiceInterface = GameSparksServiceInterface; } void UTLPGameInstance::OnGameSparksAvailable(bool available) { if (!ensure(GameSparksServiceInterface != nullptr)) { return; } GameSparksServiceInterface->ConnectedToGameSparks(available); }
In my widget class..
bool UBoardingMenuWidget::Initialize() { bool success = Super::Initialize(); UTLPGameInstance * TLPGameInstance = Cast<UTLPGameInstance>(GetWorld()->GetGameInstance()); if (TLPGameInstance != NULL) { TLPGameInstance->SetGameSparksServiceInterface(this); TLPGameInstance->ConnectToGameSparksService(); } }
This code is working fine Editor, PC build , but its crashing on Android Build.
If I comment this line below, then android build works fine.
//TLPGameInstance->ConnectToGameSparksService();
This is the log from UE4.
LogPlayLevel: 09-05 00:34:44.660 32241 32279 D UE4 : [2018.09.04-19.04.44:660][ 0]UGameSparksModuleLog: Warning: GameSparks::StartupModule
ANURAG SHARMA
This is my GameInstance class.
In my widget class..
This code is working fine Editor, PC build , but its crashing on Android Build.
If I comment this line below, then android build works fine.
//TLPGameInstance->ConnectToGameSparksService();