# How to access the UE4 Editor Clock/Ticking System for use in a Plugin

**URL:** <https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010>\
**Category:** Plugins\
**Tags:** tick, engine, unreal-engine, editor, Plugins, question\
**Created:** [September 27, 2020, 4:00am UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010 "2020-09-27T04:00:37Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_d4cf4603](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d4cf4603](https://forums.unrealengine.com/u/anonymous_user_d4cf4603)\
**Post date:** [September 27, 2020, 4:00am UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/1 "2020-09-27T04:00:37Z")

</div>

Hi,  
I am creating a plugin where I need to access the clock or a ticking system for the editor rather than the game. Is there a way I could bind to the editor’s clock, ticking system, or event scheduler to run a callback every n seconds or every frame?

Thank you.

---

<div class="post-metadata">

**Author:** ![irajsb](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/irajsb/32/740687_2.png) [@irajsb](https://forums.unrealengine.com/u/irajsb)\
**Post date:** [September 27, 2020, 5:29am UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/2 "2020-09-27T05:29:18Z")

</div>

try to see if GetWorld() is valid at editor time!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d4cf4603](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d4cf4603](https://forums.unrealengine.com/u/anonymous_user_d4cf4603)\
**Post date:** [September 27, 2020, 11:14am UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/3 "2020-09-27T11:14:41Z")

</div>

Thank you, however I am in need of an editor singleton getter, rather than a world getter.

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [September 28, 2020, 8:29am UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/4 "2020-09-28T08:29:08Z")

</div>

Editor also has its own World.

If you want to hook into it from a plugin, you can do something like this in StartupModule :

```
auto delegate = FWorldDelegates::FWorldInitializationEvent::FDelegate::CreateRaw(this, &FMyPlugin::OnPostWorldInitialization);
FWorldDelegates::OnPostWorldInitialization.Add(delegate);

```

With callback like this :

```
void FMyPlugin::OnPostWorldInitialization(UWorld* World, const UWorld::InitializationValues IVS)
{
    if (World)
    {
	    // World->GetTimerManager
        // or
        // World->SpawnActor
    }
}

```

Note that editor spawns multiple worlds, so you may want to add some checks if you only want to use a specific one, like World-\>IsEditorWorld() or World-\>IsPlayInEditor() or World-\>IsGameWorld().

I’d suggest spawning an Actor into the world to use timer or tick, rather than trying to bind the timer manager to a plugin function.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d4cf4603](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d4cf4603](https://forums.unrealengine.com/u/anonymous_user_d4cf4603)\
**Post date:** [September 28, 2020, 1:43pm UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/5 "2020-09-28T13:43:48Z")

</div>

Thank you. However, I am getting a “Cannot open include file: ‘Engine/World.h’: No such file or directory” error when I go to compile. However, Intellisense reconizes the .h file and no longer errors out the FWorldDelegates. Any ideas on what might be occurring?

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [September 28, 2020, 3:58pm UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/6 "2020-09-28T15:58:34Z")

</div>

Make sure you include “Engine” in your Build.cs file

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d4cf4603](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d4cf4603](https://forums.unrealengine.com/u/anonymous_user_d4cf4603)\
**Post date:** [September 28, 2020, 5:20pm UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/7 "2020-09-28T17:20:16Z")

</div>

Thank you! The callback occurred twice even with a condition on “IsEditorWorld()”. There seems to be two calls to the FWorldDelegates::OnPostWorldInitialization that pass “IsEditorWorld()”. How might I condition, so there is only one?

---

<div class="post-metadata">

**Author:** ![Chatouille](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chatouille/32/1194622_2.png) [@Chatouille](https://forums.unrealengine.com/u/Chatouille)\
**Post date:** [September 30, 2020, 3:50pm UTC](https://forums.unrealengine.com/t/how-to-access-the-ue4-editor-clock-ticking-system-for-use-in-a-plugin/472010/8 "2020-09-30T15:50:50Z")

</div>

Well I don’t know exactly as I’ve never used it in that specific way, but you can debug it out by printing World-\>GetName() for example. I suspect it might work like the normal game and load a world for each map. If that’s the case, you’ll want to spawn the actor in each of them. Also mark your actor RF\_Transient so it doesn’t get saved into maps.

Another option would be to spawn an UObject rather than an actor. Just store it in a UObject\* variable, and add it to the root set so it doesn’t get garbage collected. Implementing the FTickableGameObject should make your object tick like an actor, and it should be world-independent. Declaration should look somewhat like this

```
UCLASS()
class UMyObject : public UObject, public FTickableGameObject
{
	GENERATED_BODY()
public:
	// FTickableGameObject interface
	virtual void Tick(float DeltaTime) override;
	virtual TStatId GetStatId() const override { RETURN_QUICK_DECLARE_CYCLE_STAT(UMyObject, STATGROUP_Tickables); }
	virtual bool IsTickable() const override { return true; }
	virtual bool IsTickableWhenPaused() const override { return true; }
};

```

Then you can create your object directly in StartupModule and don’t even need to mess with worlds

```
MyObject = NewObject<UMyObject>();
MyObject->SetFlags(RF_MarkAsRootSet);
```
