# Is the activity in the construction script cooked into the game build?

**URL:** <https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016>\
**Category:** Blueprint\
**Tags:** unreal-engine, Blueprint, question\
**Created:** [July 29, 2025, 4:57am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016 "2025-07-29T04:57:47Z")\
**Posts on this page:** 16\
**Page:** 2

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 1, 2025, 10:50am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/21 "2025-08-01T10:50:13Z")

</div>

Hey! Thanks! Are you up the whole night coding? Like I was many years ago. 🙂 🙂  
Looking forward for more on this later. Be well!

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 1, 2025, 6:04pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/22 "2025-08-01T18:04:05Z")

</div>

![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/d/7cd4b4b27ac56aaca8379dbd802c8b24e75ffbac.png)  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/c/a/7ca2e14f66a5611dadeb719985609de5eadd22aa.png)  
As you can see this code is in the construction script of an actor that is placed in the sublevel in the Unreal Engine Editor. All this code runs in the editor as well as the packaged shipping build. I tested it several times.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 1, 2025, 6:14pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/23 "2025-08-01T18:14:34Z")

</div>

How do you know its running in the packaged game, and didn’t just do it during packaging?.. 🤔

Why not try a script that does something different every time you run it, like chooses the color of a cube in the level.

If the cube changes color every time you load the level in a packaged build, my theory is shot 🤣

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 1, 2025, 9:19pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/24 "2025-08-01T21:19:07Z")

</div>

> [@DiliupG](#):
>
> Are you up the whole night coding?

I’m too old for that anymore. I just have a skewed schedule. Yesterday was a late late late one.

Is your project single player or multiplayer?  
If MP, Listen or dedicated?  
Are you using World Composition?

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 1, 2025, 9:26pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/25 "2025-08-01T21:26:03Z")

</div>

> [@ClockworkOcean](#):
>
> If the cube changes color every time you load the level in a packaged build, my theory is shot

Modification to SELF should work fine in CS. Accessing other actors in the level and their data is the issue.

Actors have to be loaded, read from drive and stored in memory, to access data about them. The class executing the code and whether or not it’s client or server-side matters.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 2, 2025, 7:01am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/26 "2025-08-02T07:01:32Z")

</div>

> [@Rev0verDrive](#):
>
> other actors in the level

Right, but this is always an issue, even in editor.

I have no idea about MP 🤓

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 2, 2025, 8:56am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/27 "2025-08-02T08:56:23Z")

</div>

As far as I know, the code that runs in the cooking process gets all the data required, and then it is cooked with all levels and actors because the game runs without any errors, the player can shoot enemies or pick up objects, and the next time the game is run, the destroyed actors are removed. I can load a checkpoint or start a new game, continue from a checkpoint after the player is killed, etc., etc., which is the main mechanic of the game, and it works perfectly. So even if the code runs in the packaging only, which is what really happens, my objective is achieved. But I will try this randomly changing color cube to see if the code actually runs in the packaged game and get back to you. Thanks for the collaboration.

---

<div class="post-metadata">

**Author:** ![Rev0verDrive](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rev0verdrive/32/907214_2.png) [@Rev0verDrive](https://forums.unrealengine.com/u/Rev0verDrive)\
**Post date:** [August 2, 2025, 10:35am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/28 "2025-08-02T10:35:41Z")

</div>

Actors we place in a level are technically spawned at run time. The Level simply stores transforms and class names for what goes where.

Instances of an actor have to be loaded in memory and instantiated in order to reference it. CS will cook a class reference, but no data about the class will be stored. An object reference is essentially a pointer to an address in memory.

For example `Get all actors of class` will only access what’s loaded in memory and instantiated at the time of execution. You can have 20 instances of a class in a level, but only get 5 results.

I’ll work up a good demo example this weekend.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [August 2, 2025, 11:31am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/29 "2025-08-02T11:31:33Z")

</div>

I believe you 😃

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 2, 2025, 4:18pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/30 "2025-08-02T16:18:57Z")

</div>

my game is a single-player FPS. I am using world composition, with sublevel streaming based on the player’s proximity.

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 2, 2025, 4:20pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/31 "2025-08-02T16:20:20Z")

</div>

Looking forward to this.

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 2, 2025, 4:25pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/32 "2025-08-02T16:25:42Z")

</div>

True, but when I place my enemies in the level and check the variables i want se they are always correct because I am running them in the construction script. So, theoretically, what is IN THE LEVEL is calculated before beginplay and added to the variables. This is not a speculation. I tested this. My packages game was tested on several machines and ran correctly, updating saves, loading values, restating the game, starting from a checkpoint, etc.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [August 2, 2025, 6:19pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/33 "2025-08-02T18:19:09Z")

</div>

Can I just _voice of reason_ ask - why bother with this?

Just move the code to begin play - and add some proper isValid checking like you should do anyway when accessing any actor.  
And thats’s that.

From trying this - you basically have no guarantee that on create will run even when you (or maybe specifically when you) manually spawn in the object.

On destroy doesn’t even work right, so if you are good at what you do you just create your own garbage collector in c++ instead…

And sure, Maybe this works at the level blueprint level - but one can also argue that using level blueprints is bad practice and shouldn’t be done. So it’s kind of a “moo” point…

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 2, 2025, 7:25pm UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/34 "2025-08-02T19:25:55Z")

</div>

The level blueprint is not used for any coding purposes. The actors are placed in the level manually. all save load and spawn code is in the game instance and game manager, and the respective code for player and Ai in parent blueprints. The level bps are there by design. When you create sublevels, the level blueprints are created. I use a Level Manager to look after spawning and destroying in each sublevel.

---

<div class="post-metadata">

**Author:** ![MostHost\_LA](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mosthost_la/32/907035_2.png) [@MostHost\_LA](https://forums.unrealengine.com/u/MostHost_LA)\
**Post date:** [August 3, 2025, 5:30am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/35 "2025-08-03T05:30:37Z")

</div>

Doesn’t really change much of anything - construction/destruction would be good for blueprint accessible garbage collection for instance - but it doesn’t work. (Never has reliably).

So what everyone does is to use begin play and specifically levarage whatever death function you create or custom destruction you need as an interface call - if you want to manually fuss over proper disposal of things via blueprint.

Not saying you can’t do whatever you want - saying that testing it and figuring it out when its going to change on you tomorrow because an epic employee got up on the wrong side of the bed is pointless - since you have Begin Play which will never really change behaviour…

---

<div class="post-metadata">

**Author:** ![DiliupG](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/diliupg/32/1071099_2.png) [@DiliupG](https://forums.unrealengine.com/u/DiliupG)\
**Post date:** [August 3, 2025, 8:43am UTC](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016/36 "2025-08-03T08:43:32Z")

</div>

Thanks! What you say makes sense. But I am on UE 4.27.2 and it’s very unlikely that anyone will bother to update anything on this version anytime soon, but what you say is true. I’ll change things around and see if my game still works as it is.

[Previous page](https://forums.unrealengine.com/t/is-the-activity-in-the-construction-script-cooked-into-the-game-build/2622016.md?page=1)
