Hi, I’m pretty new to the engine, and despite everything working as intended (in the viewport that is, the code appears to be doing what I meant to achieve), I’m getting 2-4 Blueprint Runtime Errors pointing to a spefcific node in my code whenever I run a simulation. I’ve tried searching for solutions to the issue but everything I found either made no difference at all or caused crashes/infinite loops (like the isValid? check, for instance). I also tried countless different blueprint configurations in the forms of forEach/while loops, branches, sequences and so on but I can’t seem to get it right.
The full error message reads as follows:
Blueprint Runtime Error: “Accessed None trying to read property SelectedDoorSpawn”. Node: SpawnActor Door Test Graph: EventGraph Function: Execute Ubergraph Dungeon Generator V2 Blueprint: Dungeon_Generator_V2
Here’s a couple snippets of my blueprint code where the issue seems to occur:
I would add an IS_VALID? node between the RANDOM and SELECT_DOOR_SPAWN nodes to make sure that the variable being pulled from the RANDOM node exists, and then pulling from the true condition, I would place a PRINT_STRING node right after the SELECT_DOOR_SPAWN node, connecting the output pin of the latter into the input of the former.
This way you can test if the variable exists.
Add a PRINT_STRING to the false condition that notifies you that a check has failed.
Hello and thank you for your reply! Following your advice, I first placed the isValid? node there as well as the printString on false; then I placed the second printstring in between the set and the spawn actor and got something at last:
Alright, I tried recording what’s going on in game, but I don’t think that’s much to go on by. If it acts up sometimes it’s because the logic in some parts of my code is flawed, so it just gets stuck re-creating overlapping rooms sometimes (it has a 20 seconds timer before it restarts itself), but that’s besides the point. Here you go anyways
Look at what the PRINT_STRINGS are telling you. You got “IS_NOT_VALD” multiple times, which means that one or more of the members of your array do not exist or are empty. This is what’s causing the error.
Okay, so now you have to figure out which indices are not valid.
You can actually see that “IS_NOT_VALID” is printed to the screen four times, and once you exit game mode, you get four errors.
I did, it points me to the same spawn actor door node I highlit in yellow in my first screenshot, but I cannot figure out what’s causing it, it’s what I’m trying to understand here; to the best of my knowledge this could either be the intersections list variable being invalid, or the door blueprint itself, but I don’t see how either of those things could happen…
Is the random evaluation, you’re accessing it twice. It means that you check if one random item in the array is valid but then generate another random valid and assign it as Selected - if you had any invalid entries in the array, it might be one of them.
We can see you append a bunch of arrays, perhaps you could explain how you populate them to start with?
Hi, I think I get what you mean, but how am I to set the variable and checking if it’s valid if that’s the case? If there’s a way to do both things sequentially, that is.
About the appends, I’m simply just moving elements from other arrays as they get picked, like this:
I tried doing that but I’ve no idea what this all means nor how it’s any helpful… I now know there’s array elements that aren’t valid for whatever reason but no clue how they got into the array in the first place nor how to avoid picking them…
I have absolutely no idea! The arrays are made up of “exits” and “junction” points from each corridor/room, which are just arrows pointing to a direction, from which I gather the world transform to connect other rooms/corridors.
In short: I’m getting objects to obtain their positions to spawn meshes in that location and orientation (so that they appear seamlessly connected), nothing more, nothing less… Again, it works just fine for the dungeon generation, as well as for the door generation itself, but the latter is giving me these log errors for some unknown reason
Are these reference objects persistent or are they spawned themselves?
Do you have more than one level? (ie. Sublevels?)
Did you create this project from scratch or is it something prebuilt that you’re building on?
The reference objects are just simple meshes that give the spawner a translation to work with, correct? Then are you absolutely certain they aren’t destroyed or despawned at any point in time?
The objects are spawned via custom events, in a sequence; the whole level gets generated randomly each time
No, I do not. It’s the only level
I got the idea from a video tutorial, on top of which I added my own ideas (different elevation, separation between corridors and rooms, as well as adding these doors at every intersection).
If it’s any helpful my code is based off of this.
The reference objects are just arrow components from the basic actor editor, from which I gather the current world transform, correct. Some of them are getting destroyed, but they don’t make it into the lists if that happens, as they are discarded at an earlier point in a branch.
THIS is a problem, because if you are randomizing the array, then you can draw from items that do not exist yet. That’s why I asked.
You need to validate the existence of the object BEFORE attempting to extract its translation.
You’re playing with fire, my dude. In theory, what you are trying to do SHOULD work, but unless your code is AIRTIGHT, you WILL get errors.
Like I mentioned above, make absolutely certain these reference items exist BEFORE adding them to the array (I’m guessing you’re using the APPEND node to do this) by utilizing VALIDATED GETS or IS_VALIDs.
Unfortunately, I have no idea. Again, not my project.
You have to make sense of where the error is pointing you. Usually there’s a pop-up window that appears (with errors) when you enter and exit Play Mode. There, there’s usually a hyperlink that takes you directly to the source of the problem.
“GET_ITEM_6”, whatever that means, doesn’t exist yet.