Guest User

GameMode in SinglePlayer randomly stop existing

a guest
Apr 15th, 2020
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.03 KB | None | 0 0
  1. GameMode in SinglePlayer randomly stop existing
  2.  
  3.  
  4. Hello!
  5.  
  6. I meet again problem with GameMode. I spent few days and can't figure it out why this happen.
  7.  
  8. Blueprint node GetGameMode return "none" after randomly time of playing.
  9.  
  10. What I tested:
  11. 1. Editor: GetGameMode off to IsValid sometimes return:
  12. a. Not Valid (GameMode is None)
  13. b. Is Valid (Function inside GameMode is never run - Error inform that MyGameMode is Pending Kill)
  14. 2. Editor: I try to run RestartPlayer (Function of GameMode) from Player Controller blueprint.
  15. 3. Editor: I try to run RestartPlayer (Function of GameMode) from Character blueprint.
  16. 4. Editor: I try create custom event inside MyGameMode which run RestartPlayer but cannot run this custom event inside MyGameMode also.
  17. 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.
  18. 6. VS: in Entire Solution put breakpoints on setting "AuthorityGameMode" but do not catch anything.
  19. 7. VS: try to debug GetGameMode() inside GameplayStatics.cpp:
  20. 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 :-(
  21.  
  22. AGameModeBase* UGameplayStatics::GetGameMode(const UObject* WorldContextObject)
  23. {
  24. UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::LogAndReturnNull);
  25. return World ? World->GetAuthGameMode() : NULL;
  26. }
  27.  
  28. World in first line is always well.
  29. In second line GetAuthGameMode() return nullptr.
  30.  
  31.  
  32.  
  33. Other information.
  34. A. I try to run RestartPlayer from GameMode so cannot move my code to GameInstance or PlayerController.
  35. 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.
  36. 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)
  37. D. I search information about it in google, but can't find not even ONE !!!
  38. E. UE 4.24.3
  39. 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.
  40. G. When I try to run RestartPlayer function from not valid return of GetGameMode I have error:
  41.  
  42. LogScript: Warning: Attempted to access MyGameMode_C_0 via property CallFunc_GetGameMode_ReturnValue, but MyGameMode_C_0 is pending kill
  43. MyCharacter_C /Game/GG/Maps/UEDPIE_0_PlayMap.PlayMap:PersistentLevel.MyCharacter_C_1
  44. Function /Game/GG/Play/MyCharacter.MyCharacter_C:ExecuteUbergraph_MyCharacter:00CC
  45. 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
  46.  
  47.  
  48. If this is not Engine BUG, where can I look for my mistakes ?
Add Comment
Please, Sign In to add comment