Just a quick one.
I created a crafting system and use an actor class called craftingMaster which just holds a struct (isUnlocked bool, integers for each item required in the recipie) and an array of classes for each recipie called craftingRecipieClasses (a manually set array of each child class BP of craftingMaster since theres no way in BPing to access assets not in memory at runtime to build the array automatically)
I then create child classes (as in right click → create blueprint based on this) for each “recipie”.
I then placed craftingMaster in the level (again no mesh, just a BP with 2 variables).
Then to start building the crafting system to create a GUI I used the following logic to spawn the child classes and build an array of the actors to get their individual data: (written verison at the bottom before I added the fix and because its hard to read)
Very oddly this created each child class but it also created 28 null actors (28+4 real classes = 32).
So I did a isValid check and that got rid of them but then I tried adding a new child class.
1) First it wouldnt recognize new child classes unless I deleted the masterCrafting actor from the level and put it back in manually. (This was later fixed by just spawning the actor first before anything else) which felt odd, dont know if this is a bug or intentional or just the way blueprints work in this situation
2) Secondly, once I did delete and re-add the masterCrafting parent class it would recognize new children classes but I still got the number of classes % 32 nulls. So for 5 classes I had 27 nulls, 6 classes 26 nulls etc.
When I did do the fix of spawning masterCrafting intitally it fixed the nulls and the not detecting new children classes but thought I should mention this anyway.
FirstPersonCharacter :: BeginPlay() → GetAllActorsOfClass(craftingMaster) :: Get pull of the the and get craftingRecipieClasses which plugs → ForEachLoop()
1.SpawnActor(Class = array element (aka craftingRecipieclasses), Transform = 0,0,0 0,0,0 1,1,1, SpawnIfColliding = true)
2. Take returned actor and Add(recipieActorsInLevelArray)
Sorry for the long post. If you’d like me to replicate this in a fresh 1p template project to test and give simpiler instructions and a clearer picture I will gladly.