Actors in Actor Array Not Valid

I’ve been struggling with this issue for the past 2 weeks or so i think i need help :frowning:

so the way it’s supposed to work is … your supposed to add a particular actor to an array when you overlap the pickup …

if i check the items in the array from the pickup actor … it will return the expected value (pickup1 … pickup2 … etc)

however if i try to check whats inside the pickups array from outside of the pickup actor … it returns as … gibberish … or none … or something

the length says their are actors in the array

and if i used a string or a name it would work fine …

why can’t i get this to work with actors?

The code you have posted looks fine, so I assume you’re doing to the array somewhere else. Either in the GI or elsewhere.

You can always right-click on the variable to find out everywhere its used.

PS: I’m assuming this is all during one run. Obviously you can’t stop play, then restart, and expect something to be in the array :slight_smile:

yes, the Array is inside of my game instance / the GI

the original idea was to save it into a SaveGameObject and reload it into the GI when the game loads

this works with other types of variables however with the actor it farts up :confused:

but even if i forgo the saving function and use a basic event like T to load the collectedpickups after i collected em during the same run … they still return as ‘not valid’



Yes, you can’t save actor references, they are a runtime thing :slight_smile:

Like I say, the concept should be fine, but if you do anything to invalidate the references ( like changing levels ), it won’t work.

even without the save function

the same runtime …

the same level …

as soon as i collect something and press T … the actor returns as not valid

1 Like

Then I guessing you might be overwriting it somewhere. I can’t see all the code… :thinking:

you’re adding Actors to an Array but not removing them, that i can see.

your actors are ‘Pickups’ usually a pickup with be destroyed on pickup, but the ref exists inside the array its just it’ll be a NULL ref

2 Likes

oh … i see …

destroying the actor makes the thing in the array null …

… and you can’t save actors apparently …

somehow i feel like im not really any closer to getting this thing to work the way i want it to work …

how on gods green earth did ryan layley get their thing to work??? :confused:

if your goal is to save/load pickups a simple system is

on save you can GetAllActorsOfClass to find your existing pickups and save their class/transform

on load you can GetAllActorsOfClass, destroy all those Actors, then loop off your save list, SpawnActorOfClass at saved Transform