# How to register a Tick function to the editor global?

**URL:** <https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [June 6, 2019, 9:32am UTC](https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236 "2019-06-06T09:32:12Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![LiangYuan93](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LiangYuan93](https://forums.unrealengine.com/u/LiangYuan93)\
**Post date:** [June 6, 2019, 9:32am UTC](https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236/1 "2019-06-06T09:32:12Z")

</div>

I am making a plugin which has its own thread to handle requests from other apps. One thing I want to do is to import raw resources created by other app to UE contents(uassets for animation, mat, mesh and so on). The problem I got is that all import functions I can find is not thread safe, so that I have to store those import requests trigger by sub thread to a vector and handle them in my game thread.

The only way I came up with is to spawn an actor in plugin’s StartupModule function and look into the request queue in the actor’s Tick function. But I can’t find a good example to follow to create a “shadow” Actor and ticks it in editor. So I am wondering if I went the right direction. Is there other way to achieve this functionality? If no, how to spawn an actor out of the “World” and get it ticked? I am new to UE4 so could you guys give me some hints? Thanks.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [June 6, 2019, 2:46pm UTC](https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236/2 "2019-06-06T14:46:12Z")

</div>

You can implement tick to any object by adding inference to FTickableGameObject or FTickableEditorObject the class (like interface) it self don’t event need to be UObject so you can do this on module class or any class you can think off.

> **[FTickableObjectBase](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/FTickableObjectBase/)**
>
> Base class for tickable objects

> **[FTickableGameObject](https://docs.unrealengine.com/5.1/en-US/API/Runtime/Engine/FTickableGameObject/)**
>
> This class provides common registration for gamethread tickable objects.

> **[FTickableEditorObject](https://docs.unrealengine.com/5.1/en-US/API/Editor/UnrealEd/FTickableEditorObject/)**
>
> This class provides common registration for gamethread editor only tickable objects.

If tick involves game it self use FTickableGameObject and ot make it tick to editor override IsTickableInEditor and IsTickableWhenPaused to make it return true. If it’s more for editor functions use FTickableEditorObject

Once you set it up just override Tick function as you normally do in actor

here is some example from engine source:

[https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Plugins/Runtime/MIDIDevice/Source/MIDIDevice/MIDIDeviceModule.cpp](https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Plugins/Runtime/MIDIDevice/Source/MIDIDevice/MIDIDeviceModule.cpp)

[https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/NiagaraMetaDataCollectionViewModel.h](https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Plugins/FX/Niagara/Source/NiagaraEditor/Private/ViewModels/NiagaraMetaDataCollectionViewModel.h)

[https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Editor/SkeletonEditor/Private/SkeletonEditor.h](https://github.com/EpicGames/UnrealEngine/blob/7d9919ac7bfd80b7483012eab342cb427d60e8c9/Engine/Source/Editor/SkeletonEditor/Private/SkeletonEditor.h)

---

<div class="post-metadata">

**Author:** ![LiangYuan93](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LiangYuan93](https://forums.unrealengine.com/u/LiangYuan93)\
**Post date:** [June 10, 2019, 3:08am UTC](https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236/3 "2019-06-10T03:08:18Z")

</div>

It works! thank you.

---

<div class="post-metadata">

**Author:** ![darkczar](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@darkczar](https://forums.unrealengine.com/u/darkczar)\
**Post date:** [October 7, 2020, 2:31pm UTC](https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236/4 "2020-10-07T14:31:40Z")

</div>

Those links do not work anymore. Is there somewhere else to see the example code?

---

<div class="post-metadata">

**Author:** ![xDPa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@xDPa](https://forums.unrealengine.com/u/xDPa)\
**Post date:** [April 17, 2021, 1:01pm UTC](https://forums.unrealengine.com/t/how-to-register-a-tick-function-to-the-editor-global/450236/5 "2021-04-17T13:01:24Z")

</div>

The “example code” is the unreal engine source code. Just open UE4.sln and search for MIDIDeviceModule or SkeletonEditor.

To be more specific about this topic: You have to create an instance of your own FTickableEditorObject and it will register itself to the engine/editor update loop.

```
class FAssetTest : public FTickableEditorObject
{

public:
	virtual void Tick(float DeltaTime) override
	{
		TimePassed += DeltaTime;
	}

	virtual ETickableTickType GetTickableTickType() const override
	{
		return ETickableTickType::Always;
	}
	virtual TStatId GetStatId() const override
	{
		RETURN_QUICK_DECLARE_CYCLE_STAT(FAssetTest, STATGROUP_Tickables);
	}
	virtual bool IsTickableWhenPaused() const
	{
		return true;
	}
	virtual bool IsTickableInEditor() const
	{
		return true;
	}

private:
	float TimePassed = 0;

};

void ExampleModule::StartupModule()
{
	...

	auto AssetTest = new FAssetTest(); // "memory leak"
}
```
