# Get variables from a not yet spawned bp (prefab)

**URL:** <https://forums.unrealengine.com/t/get-variables-from-a-not-yet-spawned-bp-prefab/549683>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 5, 2022, 3:40pm UTC](https://forums.unrealengine.com/t/get-variables-from-a-not-yet-spawned-bp-prefab/549683 "2022-05-05T15:40:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ObeseWanKenobi86](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ObeseWanKenobi86](https://forums.unrealengine.com/u/ObeseWanKenobi86)\
**Post date:** [May 5, 2022, 3:40pm UTC](https://forums.unrealengine.com/t/get-variables-from-a-not-yet-spawned-bp-prefab/549683/1 "2022-05-05T15:40:53Z")

</div>

I want to spawn a planet and a orbit (which is just a spline) bp when the game starts.

To move the planet along the spline I first need a reference of the orbit bp and then the spline but because the orbit bp is not yet created I can’t get the spline from it.

(the orbit bp is spawned first and then the planet)

gets a reference of the specific orbit bp:

 ![Schermafbeelding 2022-05-05 173728](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/e/2/3e2f5257d2ad94d18036be5345e0c5455a36fa47.png)

Here is the problem:

 ![Schermafbeelding 2022-05-05 173742](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/a/b7a3f1f5628568256d9e18ef3d27aefebab7aab9.png)

---

<div class="post-metadata">

**Author:** ![Quetzalcodename](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Quetzalcodename](https://forums.unrealengine.com/u/Quetzalcodename)\
**Post date:** [May 5, 2022, 4:07pm UTC](https://forums.unrealengine.com/t/get-variables-from-a-not-yet-spawned-bp-prefab/549683/2 "2022-05-05T16:07:58Z")

</div>

Hey @ObeseWanKenobi86! Are you attempting to spawn the spline at the same time you spawn your blueprint? Sounds like you want to use a combination of one or two things. The first thing you may want to do is check the “[Expose on Spawn](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Variables/#:~:text=for%20the%20variable.-,Expose%20on%20Spawn,-Expose%20on%20Spawn)” box on your variable. This will let your blueprint know the variable should be accessible at the time of spawning the blueprint. The next thing you need to do is use a [Set Node](https://docs.unrealengine.com/4.27/en-US/ProgrammingAndScripting/Blueprints/UserGuide/Variables/#:~:text=use%20Y%20instead.-,Getting%20%26%20Setting%20Variable%20Values,-Variables%20can%20also) between your Spline REF node and Get Spline Length node.

---

<div class="post-metadata">

**Author:** ![ObeseWanKenobi86](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@ObeseWanKenobi86](https://forums.unrealengine.com/u/ObeseWanKenobi86)\
**Post date:** [May 5, 2022, 6:47pm UTC](https://forums.unrealengine.com/t/get-variables-from-a-not-yet-spawned-bp-prefab/549683/3 "2022-05-05T18:47:05Z")

</div>

I want to get a reference of the spline so I think ‘Expose on Spawn’ doesn’t work because it isn’t a var. I don’t really get what you’re trying to say with ‘set node’, what do I set?

Because at the start of the game I spawn a random amount (between 3-6) of planets with each having its orbit bp, maybe I could already create 6 planets and their orbits before the game has started and just delete a random amount?

I’m now going to try the above idea
