Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- GameMode in SinglePlayer randomly stop existing
- Hello!
- I meet again problem with GameMode. I spent few days and can't figure it out why this happen.
- Blueprint node GetGameMode return "none" after randomly time of playing.
- What I tested:
- 1. Editor: GetGameMode off to IsValid sometimes return:
- a. Not Valid (GameMode is None)
- b. Is Valid (Function inside GameMode is never run - Error inform that MyGameMode is Pending Kill)
- 2. Editor: I try to run RestartPlayer (Function of GameMode) from Player Controller blueprint.
- 3. Editor: I try to run RestartPlayer (Function of GameMode) from Character blueprint.
- 4. Editor: I try create custom event inside MyGameMode which run RestartPlayer but cannot run this custom event inside MyGameMode also.
- 5. Editor: I try "Get All Actors of Class" which search MyGameMode - this work same as "Get Game Mode" node, after random time "Get All Actors of Class" not find MyGameMode Instance.
- 6. VS: in Entire Solution put breakpoints on setting "AuthorityGameMode" but do not catch anything.
- 7. VS: try to debug GetGameMode() inside GameplayStatics.cpp:
- 8. Editor: GetGameMode check by IsValid and when "Is Not Valid" try to run GetGameMode check again after 0.1 second - never work again - simply GameMode Instance disappear :-(
- AGameModeBase* UGameplayStatics::GetGameMode(const UObject* WorldContextObject)
- {
- UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
- return World ? World->GetAuthGameMode() : NULL;
- }
- World in first line is always well.
- In second line GetAuthGameMode() return nullptr.
- Other information.
- A. I try to run RestartPlayer from GameMode so cannot move my code to GameInstance or PlayerController.
- B. My game is now Single Player but split screen with two Player Controllers and Two Pawns. But soon I want to make multiplayer with sessions.
- C. Two month ago I met same problem with GameMode with Multiplayer Game which I programmed. I overpass it to move my co from GameMode to GameInstance (which is not good solution)
- D. I search information about it in google, but can't find not even ONE !!!
- E. UE 4.24.3
- F. Very strange is that sometimes after first player death when I need to GetGameMode is failed, sometimes after 30 player deaths GetGameMode failed - for me is randomly.
- G. When I try to run RestartPlayer function from not valid return of GetGameMode I have error:
- LogScript: Warning: Attempted to access MyGameMode_C_0 via property CallFunc_GetGameMode_ReturnValue, but MyGameMode_C_0 is pending kill
- MyCharacter_C /Game/GG/Maps/UEDPIE_0_PlayMap.PlayMap:PersistentLevel.MyCharacter_C_1
- Function /Game/GG/Play/MyCharacter.MyCharacter_C:ExecuteUbergraph_MyCharacter:00CC
- PIE: Error: Blueprint Runtime Error: "Attempted to access MyGameMode_C_0 via property CallFunc_GetGameMode_ReturnValue, but MyGameMode_C_0 is pending kill". Blueprint: MyCharacter Function: Execute Ubergraph My Character Graph: EventGraph Node: Restart Player
- If this is not Engine BUG, where can I look for my mistakes ?
Add Comment
Please, Sign In to add comment