# How to check if game is running

**URL:** <https://forums.unrealengine.com/t/how-to-check-if-game-is-running/441567>\
**Category:** Plugins\
**Tags:** unreal-engine, editor, Plugins, UE4, question, CPP\
**Created:** [January 18, 2019, 3:01pm UTC](https://forums.unrealengine.com/t/how-to-check-if-game-is-running/441567 "2019-01-18T15:01:39Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![tuatec](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@tuatec](https://forums.unrealengine.com/u/tuatec)\
**Post date:** [February 25, 2022, 9:44pm UTC](https://forums.unrealengine.com/t/how-to-check-if-game-is-running/441567/12 "2022-02-25T21:44:58Z")

</div>

I know this thread is very old but the solution I found gives very precise results through the enumerator “EWorldType::Type” present in “Engine/EngineTypes.h” and you can easily extend it for PIE, Game, GamePreview …

Additionally, you can ask every UObject where it is currently running. 😉

```auto
// Utils.h
#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "Utils.generated.h"

UCLASS()
class TTCOMMON_API UUtils : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()
public:
	// returns true if the given 'Object' is instantiated and running in Editor Preview (e.g. Persona, AnimBP...)
	UFUNCTION(BlueprintCallable, Category = "Utils", meta = (Keywords = "editor tools"))
	static bool IsRunningInEditorPreview(UObject* Object);
};

// Utils.cpp
#include "UUtils.h"
#include "Engine/EngineTypes.h"
bool UUtils::IsRunningInEditorPreview(UObject* Object)
{
  if (!Object)
  {
    return false;
  }

  if (auto world = Object->GetWorld())
  {
    return world->WorldType == EWorldType::EditorPreview;
  }

  return false;
}

```

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-check-if-game-is-running/441567)._
