Announcement

Collapse
No announcement yet.

[Feature] Allow GetSeamlessTravelActorList to be hooked in blueprint GameMode

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    [Feature] Allow GetSeamlessTravelActorList to be hooked in blueprint GameMode

    I'm currently using this as my base class for my gamemode, and all works well. I just add actors to this list that I need to persist during seamless travel

    Click image for larger version

Name:	UE4Editor_T8iMMXD8w1.png
Views:	1
Size:	152.4 KB
ID:	1615502

    Code:
    #include "GM_CODE_Base.h"
    
    void AGM_CODE_Base::GetSeamlessTravelActorList(bool bToTransition, TArray<AActor*>& ActorList)
    {
        ActorList = K2_OnGetSeamlessTravelActorList(bToTransition, ActorList);
        Super::GetSeamlessTravelActorList(bToTransition, ActorList);
    }
    Note: If you want to know what the server wants to save, apart from what you are adding, you would move the call to Super above my call. However, this would be unsafe, as we should be trusting the engine and not messing with it.
    Last edited by EvoPulseGaming; 05-04-2019, 06:23 PM.
    Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap
    Plugins:
    ComputeShader CPU->GPU->CPU || Universal TimePlugin || Universal SkyPlugin
    Other tools/functions:
    Universal GetNetwork/LocalRole

    #2
    Can I see the associated header code required to make this blueprint accessible?

    Comment


      #3
      Code:
      #include "CoreMinimal.h"
      #include "GameFramework/GameMode.h"
      #include "GM_CODE_Base.generated.h"
      
      /**
       *
       */
      UCLASS()
      class PROJECTX2150_API AGM_CODE_Base : public AGameMode
      {
          GENERATED_BODY()
      public:
      
          void GetSeamlessTravelActorList(bool bToTransition, TArray<AActor*>& ActorList);
      
          /**
          * Overridable event for GameMode blueprint to respond to a change name call
          * param bToTransition    How are we transitioning
          * param ActorList        Add actors to this list to seamless travel with.
          */
          UFUNCTION(BlueprintImplementableEvent, Category = Game, meta = (DisplayName = "GetSeamlessTravelActorList", ScriptName = "GetSeamlessTravelActorList"))
              TArray<AActor*> K2_OnGetSeamlessTravelActorList(bool bToTransitionOut, UPARAM(ref)TArray<AActor*>& ActorListOut);
      
      
      };
      Free Community Ocean & Sky Project || Join us on Discord! || Trello Roadmap
      Plugins:
      ComputeShader CPU->GPU->CPU || Universal TimePlugin || Universal SkyPlugin
      Other tools/functions:
      Universal GetNetwork/LocalRole

      Comment

      Working...
      X