I wonder if all instances of closest pickup are being cleared somehow, because the string is working fine
yet the only Set for it ever is only called during overlap, and its definitely breaking at other times
So what happens to the pickup after you have picked it up?
Even though you have a reference to it in your array, if there is a call to Destroy on that pickup after you’ve added it to the array, it will still destroy it, and that entry in the array will not be valid any more.
Garbage collection works more on keeping track of how many references an object has and destroys when there are none - if Destroy() is called, all bets are off the table…
In short the OP shouldn’t even be adding the object to the array but it’s description, like get class to a soft reference. Decouple the entry from the physical asset. Then you can outright destroy it.
so it exists in the physical world, the player grabs it, its added to the array, and then its deleted… thats probably it. But why does it take so long to take effect? and how do i take the object out of the world when its in the inventory without DestroyActor?
Should I replace the array with soft references? I don’t really know much about those
I’m not sure why it’s taking that long - it may not destroy the actor after you delete it for that amount of time.
I think what I would do is make a separate structure with details like the name of the pickup, an icon, it’s Class etc and have an Array of those instead.
I’m going to try soft references and if that doesn’t work, I’m sure this solution will
Actually that seems risky I’ll g straight to your idea
I don’t think you’ll need soft references - if you store the class in the struct you can always spawn one from that if you ever need to, but from my understanding of what you’re wanting, you’ll not need to…
Any type of inventory will sooner or later have to spawn the actor back into the world. A soft ref of the class type will do wonders. Or this could be kept inside of the datatable, but that limits the permutations of objects. (Example would be a transmog system)
whats a transmog system
It’s a system where you have a game item that will have it’s own stats , but have the visual style of another object. It’s a staple of most RPG games.
did not realize it was short for transmogrification, yeah good idea
Just crashed unreal by changing a structure value, i think its heading towards working though
Keep in mind soft objects are still “part of the loop” so don’t come for free - if you have a lot of them, maybe have both proximity spawned pickups and soft reference types for the pickups with custom settings.
Unreal won’t even open now lemme take care of this and then it shouldnt take long to finalize the struct replacement- i wasnt confident that soft objects would work for sure so im doing this instead
You can always go to a string describing the table row entry in that case.
You’ll have to go through the blueprint and change each one manually I’m afraid - the magnifier should take you to them…
Yeah I think if I was writing a transmog I’d do that…
Edt: Actually a proximity based generic pickup with string referencing a datatable could be efficient in almost any situation - nice!