Pulling Data from One Dynamically Created Composite Blueprint for Use in Another

I’m trying to reimplement a game prototype I made in Unity. I need to be able to stack rooms of various shapes and sizes on top of each other randomly. I’m using billboard components to mark where the center of the top entrance and the bottom entrances to the rooms are. I’ve got the room generator working no problem, I just can’t seem to get the billboard transform data out from the rooms. It’s no problem if the room is already created, but that doesn’t help me.

First thing I tried was creating an array with the rooms stored in it. That works, but it doesn’t know the class of the room. So I tried using a get class node to feed into the get component node, but the class was an actor component so it didn’t work.

I tried adding a calling function to just send the transform data, but I only seem to be able to reference it when the room is already in the level.

I started implementing a cast for each room type, but quickly realized that would become too bulky to make sense even if it did work for 2 rooms. So I created a _BasicRoom base blueprint that had the TopBounds and BottomBounds billboards in it, which would let me cast once, but then it seems I can’t edit their location from a child blueprint.

So basically the problem I’m trying to solve is moving one blueprint object to the location of a component on another when neither are in the level when it starts, and I’m stuck. If anyone has any ideas or knows a better way to do this, please do let me know. In closing:


What if you use a master blueprint that is responsible for spawning each room at specific location?

If you look at my map threads, my entire map is created in a series of arrays before the map is ever spawned into the world.

I’ve actually been ogling your code to try and figure out what’s going on. I guessed there might be some useful bits in there. Great work, by the way! Those look great. I can only hope that I’ll eventually be able to write something like that. The problem is that there isn’t a set location or size to spawn at. While the structure would always be going up, some rooms might be really long and others might be very tall, and some might be both, and all will have a random 90 degree rotation. Room might be a bit of a misnomer, actually, jumping challenge might be more appropriate.

Thanks! :slight_smile:

It sounds like you already have the math worked out for stacking the rooms, just that you have it tied up in each of the room blueprints to decide for themselves where they will go?

If I were you, I would take all random and changeable modifier variables for each room, and expose them on spawn in the details panel. Then, have a master generator blueprint spawn the room blueprints and feed in the modifiers. Your master blueprint would know where the room is going and it’s makeup because it knows all the modifiers that went into making the current and previous rooms. Then you can do all kinds of side math to figure out all kinds of other things, and since this is in the master blueprint it should be easier to use that information elsewhere.

I think I must be missing something. I can expose the variables on spawn, but unless the object is already in the level, the Blueprint doesn’t seem to want to let me see the object. I think its because when I instantiate it, it knows its an actor, but not the class of the actor. I tried a getclass to feed into the get components node, like so: tryingtogettopbounds.JPG
but with zero success. I’m sure I’m just being stupid here. I’ve simplified the function to strip out everything that won’t help me here to make it super easy to read.generateroomfunction.JPG

The problem is, the exposed variables don’t seem to appear unless I drop the room into the level, instantiating it, and then it only works if I reference that copy. And I can’t seem to force it to assume that the actor will be of a certain class. I rebuilt the function to expose the variables and removed all the other logic: generate location data.JPG is there anything wrong with it?

What I mean by exposing the variable on spawn is this:

See how Spline Points shows up on the Spawn Actor node? That is because inside the Blueprint for my River spline, I have that array variable “Exposed on Spawn”. This way, I can have a generic blueprint that gets fed key information it needs to properly generate in the world.

Besides that, I have never been able to get Class Variables to work reliably so I didn’t use them. It would always break for some reason.

If I were you, I would not reference your rooms based on class. You really only need that tidbit for spawning and casting.

Store your rooms in an actor array and reference them as blue actors, not by class. But that is after spawn referencing.

For referencing before spawn, I would create an Enumeration where each room has a number. So Room A = 0, Room B = 1, and so on. If you need to spawn a specific room, pull it’s number, Switch on Enum, which leads to room specific variables/functions, which are offset from the previous room’s variables/functions, etc.

I think you might have just solved it for me, I didn’t know about exposing like that. Let me give it a whirl and I’ll let you know!

Well, I’ve got it working mostly now. Thanks! A glitch that I saw was that I had to set the spawn node to a class before hooking it up to a variable for it to know what the class would contain. Now I’m working on sorting out how to keep the editor from crashing every time I run it with my room selection script. Thanks for your help! I learned something new and helpful.

No problem, good luck with your game! :slight_smile: