How can I make instances of my bp actor class have arrays/variables that count only for THOSE instances?

I’ve made ‘volumes’ with traces that report how many and which plants are in the volume (stored in an array). I assumed that if i simply dragged out 10 of these volumes they’d each individually store these plant actors in their own ‘all plants in soil’ arrays. But now I plant a plant in one volume - and it prints - good. I plant a plant in another volume - it prints both plants! i.e. that array seems to be shared by all volumes.

This really goes against my understanding of what should be going on.

Am I doing something horribly wrong blueprint wise? Or if not, is there a way to get them their own local arrays? That they store their own plants in?

This is for the purpose of each volume being able to calculate e.g. how many nutrients are being used by their plants and returning essential information for the plants’ growth rate.

Making children of the original blueprint class seems to produce the same behaviour. The string is printed, the traces fired and the array filled then cleared every time plant is spawned or destroyed.

Thank you very much in advance to anyone who’s willing to help me. This has huge implications for my other blueprint classes - and the concept for the game really… I’m hoping that I just don’t understand what’s going on.

They do all have their own arrays. Are you placing these plants with the foliage tool?

Oh! Ok thank you - that’s one question answered. So I guess it’s just how i’ve set it up somehow. The player can spawn these plants one by one by clicking so no foliage tool.

Hello! Can you share nodes or code that is used?

Yes, good idea to show some code at the point probably…

Here are some printscreens. Thanks for taking a look (the trace variables have to be reset bc the boxes form a hex)

Ok pretty hard to tell what’s going on from that.

The ‘when it fires’ BP looks a little strange. I see the blue note ( never seen that on a bind ), does it mean you’re binding to an event inside the same BP?

Also, it doesn’t make sense to bind the controller. The point of bind, is it’s a broadcast from one actor to many. So to have the event in the controller and the bind in the other blueprints make sense, but not the other way around.

Can you elucidate?

Thanks.

In the volume BP, click on the array or whatever variable you want to exist only for that instance, in the details area for editing that variable, there’s two checkboxes you can use “instance editable” and “expose on spawn” check them both. That should fix your issue.

Hm well I call an event dispatcher in the controller (i.e. the sender?) that a plant has been destroyed, but i can’t generally get a bind option to show up (i.e. the listener) unless I first cast to that controller and get a reference that way.

The blue note says: no value will be returned by reference parameter ‘Destroyed plants’ - i believe that’s the array of destroyed plants. It’s worked anyway in other bps despite the note though.

I looked at it some more (ofc) - and might the stupid reason be that every actor i place in the scene also prints its array everytime i click and thus there’s no distinguishing whats printed from what instance’s array?

you shouldn’t really need to bind anything, or use an event dispatcher.

You should look into blueprint interfaces, might be smoother for you to use in this case.

Also, how are you implementing the volumes themselves? Are the VOLUMES instanced? I may be confused lol. And is the Volume a blueprint?