# Check if actor placed from the editor

**URL:** <https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700>\
**Category:** C++\
**Tags:** spawn, actor, unreal-engine, editor, question, CPP\
**Created:** [December 15, 2014, 10:00pm UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700 "2014-12-15T22:00:03Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_55a432d8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_55a432d8](https://forums.unrealengine.com/u/anonymous_user_55a432d8)\
**Post date:** [December 15, 2014, 10:00pm UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/1 "2014-12-15T22:00:03Z")

</div>

Hello, is there a way to make a check if actor is placed from the editor or spawned from the code?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_c7307ff8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_c7307ff8](https://forums.unrealengine.com/u/anonymous_user_c7307ff8)\
**Post date:** [December 16, 2014, 12:10pm UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/2 "2014-12-16T12:10:21Z")

</div>

The best thing to do in this case is to create a boolean variable for all C++ created actors, for example:

```
bool bNotEditorSpawned

```

And obviously when spawned in C++ set it to true and everything that’s false is an editor placed actor. As far as I know that is the only way to do it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_55a432d8](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_55a432d8](https://forums.unrealengine.com/u/anonymous_user_55a432d8)\
**Post date:** [December 16, 2014, 2:42pm UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/3 "2014-12-16T14:42:37Z")

</div>

I have tried this way and it didn’t work well for me. I’m trying to set actor before spawning it from the code.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1ce13b59](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1ce13b59](https://forums.unrealengine.com/u/anonymous_user_1ce13b59)\
**Post date:** [April 27, 2015, 3:37am UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/4 "2015-04-27T03:37:53Z")

</div>

The preview actor will have the RF\_Transient object flag. You can check with Actor-\>HasAnyFlags(RF\_Transient). Transient means not saved.

> **[How can I tell if an Actor is a Preview Actor?](https://forums.unrealengine.com/questions/40167/preview-actors.html)**
>
> Hello, I have an editor related question. I have my own asset type in content browser (UObject derived). I drag it from content browser into a viewport, this creates an actor (AActor derived) and corresponding component inside that actor. The issue...

---

<div class="post-metadata">

**Author:** ![spacebares](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@spacebares](https://forums.unrealengine.com/u/spacebares)\
**Post date:** [August 17, 2017, 5:51am UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/5 "2017-08-17T05:51:37Z")

</div>

I know this is old question but its top search on google. So to answer the question directly, a `GetFlags();` on the actor will reveal the most reliable flag being **RF\_WasLoaded** for editor spawned actor. But only **IF** the actor was spawned in from a **saved** map. It is possible to have **NO** RF\_WasLoaded flag if; you drag actor into level, and hit play.

However if you drag the actor into level, **SAVE** , then hit play, the actor will receive **RF\_WasLoaded** flag everytime!  
You can then do a simple `if(HasAnyFlags(RF_WasLoaded)){ //im an editor actor! }` like so.

---

<div class="post-metadata">

**Author:** ![RotemS](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RotemS](https://forums.unrealengine.com/u/RotemS)\
**Post date:** [January 1, 2019, 1:03pm UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/6 "2019-01-01T13:03:16Z")

</div>

Bingo! Works like a charm.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_6c7b3be1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_6c7b3be1](https://forums.unrealengine.com/u/anonymous_user_6c7b3be1)\
**Post date:** [February 28, 2021, 11:38am UTC](https://forums.unrealengine.com/t/check-if-actor-placed-from-the-editor/301700/7 "2021-02-28T11:38:26Z")

</div>

There is AActor::IsNetStartupActor which returns if an actor was placed in a level or spawned at runtime (if the actor has a valid path). I think that might be a good solution for checking this.
