# Adding actors and components to a custom ALevelScriptActor

**URL:** <https://forums.unrealengine.com/t/adding-actors-and-components-to-a-custom-alevelscriptactor/430417>\
**Category:** World Creation\
**Tags:** add-component, unreal-engine, UE4, CPP, question\
**Created:** [July 28, 2018, 12:15am UTC](https://forums.unrealengine.com/t/adding-actors-and-components-to-a-custom-alevelscriptactor/430417 "2018-07-28T00:15:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BrunoCaxito](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brunocaxito/32/706161_2.png) [@BrunoCaxito](https://forums.unrealengine.com/u/BrunoCaxito)\
**Post date:** [July 28, 2018, 12:15am UTC](https://forums.unrealengine.com/t/adding-actors-and-components-to-a-custom-alevelscriptactor/430417/1 "2018-07-28T00:15:07Z")

</div>

I’m trying to add default actors and components to my custom ALevelScriptActor based levels, my code compiles with no problems, but does nothing. I’m new with Unreal’s API, is there a better/correct way to do so?

 ![248758-capturar.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/3/e/13e806238625d10afa43145e1951c2ba268fa835.png)

PS: The intellisense error is caused by this know issue [UE-62042][2]

---

<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:** [July 28, 2018, 1:25am UTC](https://forums.unrealengine.com/t/adding-actors-and-components-to-a-custom-alevelscriptactor/430417/2 "2018-07-28T01:25:21Z")

</div>

Do that on AGameMode, level script is to contain level specific code (via Level Blueprint) and only reason why you want to add C++ code is only if you want to send data to it like event and such. Probably Level Blueprint processing mess with component.

I personally used AGameMode multiple time to add post processing screen effects using post processing component and i can confirm you it works well 🙂

Absolut alternative is to make a actor with those components, spawn it in C++ and just control it

Also as extra if you want to add level specific properties, there AWorldSettings if you don’t know yet ;]

---

<div class="post-metadata">

**Author:** ![BrunoCaxito](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/brunocaxito/32/706161_2.png) [@BrunoCaxito](https://forums.unrealengine.com/u/BrunoCaxito)\
**Post date:** [July 28, 2018, 3:04pm UTC](https://forums.unrealengine.com/t/adding-actors-and-components-to-a-custom-alevelscriptactor/430417/3 "2018-07-28T15:04:17Z")

</div>

Thank-you for the answer. Althought your solution seems to work, I’ve decided to use Level Streaming to solve my problem.

The persistent level has all the common actors and behaviors for all levels (sky, fog, sicles, etc.), the ALevelScriptActor sets the streamed levels common behavior

PS: Sorry for the bad english.
