Announcement

Collapse
No announcement yet.

How to know if game is running in either PIE or Standalone mode?

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

    How to know if game is running in either PIE or Standalone mode?

    Hi.

    I have some code that I only want to execute when the game is running, either in PIE or Standalone mode.

    Code:
    void MyActor::OnConstruction(FTransform transform)
    {
        Super::OnConstruction(transform);
        DoSomething();
    }
    
    void MyActor::Tick(....)
    {
        Super::Tick(...)
        DoSomething();
    }
    
    void MyActor::DoSomething()
    {
        // .. do something here...
        if (IsPlayingInEditor) { DoSomethingMore }
        else { DoSomethingElse }
    }
    Obviously this is not the exact code. Is there a global variable or anything I can use to determine if the game is running?

    Thanks

    #2
    Found it - GetWorld().IsGameWorld()

    Comment

    Working...
    X