Dictionary load and save tutorials
-
How to delete a spawned object from the array?
I pick up an object and that object appears in the inventory. I want to remove the object from the inventory and from the array at the same time. Destroying the inventory object itself is easy, but I don’t know how to remove the source object (the one that was used to spawn the inventory object) from the array.
The problem is that the object I pick up and the object in the inventory do not share the same object ID. Every time I pick something up, the inventory gets a new object instance with a new ID.
How can I delete the original source object (the one that was used to spawn the inventory object) from the array when I destroy the inventory object?How to delete a spawned object from the array?
I pick up an object and that object appears in the inventory. I want to remove the object from the inventory and from the array at the same time. Destroying the inventory object itself is easy, but I don’t know how to remove the source object (the one that was used to spawn the inventory object) from the array.
The problem is that the object I pick up and the object in the inventory do not share the same object ID. Every time I pick something up, the inventory gets a new object instance with a new ID.
How can I delete the original source object (the one that was used to spawn the inventory object) from the array when I destroy the inventory object?For this one you want to store the source object ID in the spawned object using attributes. You can use Set Attribute to set a key with the object ID as the value. Then when destroying the object, you can use Get Attribute to retrieve it from the object.
Here's an example:
Original Object
The original object spawns another object (the red one). In the spawned object, we can set an attribute
source object idwith the original object id.
Spawned Object
The spawned object can retrieve the original object that spawned it and destroy it.

-
Thanks 😃
-
Yes but it is coming from a loop and a spawn the entire array. So what would you do?
-
A little option to destroy the source would be nice 😊
-
It’s weird because sometimes it delete the source even if the ID is not the same… For that I do a modify array by doing a get array value at index when the spawn object is touched. But it doesn’t work every time. I don’t understand why.
-
Yes but it is coming from a loop and a spawn the entire array. So what would you do?
-
It’s weird because sometimes it delete the source even if the ID is not the same… For that I do a modify array by doing a get array value at index when the spawn object is touched. But it doesn’t work every time. I don’t understand why.
It’s weird because sometimes it delete the source even if the ID is not the same… For that I do a modify array by doing a get array value at index when the spawn object is touched. But it doesn’t work every time. I don’t understand why.
It is worth noting that Get Array Value takes a number for the index. If you put text for the input, it treats it as 0 (getting the first element instead).
-

-
How to manage the attribute keys with multiple objects.
Unlike in your example I have many object spawn at the same time. What do I put instead of “source object id”? Does it have to be dynamic? -
How to manage the attribute keys with multiple objects.
Unlike in your example I have many object spawn at the same time. What do I put instead of “source object id”? Does it have to be dynamic?How to manage the attribute keys with multiple objects.
Unlike in your example I have many object spawn at the same time. What do I put instead of “source object id”? Does it have to be dynamic?It looks like you're spawning multiple objects per iteration - maybe you meant to spawn one object per iteration?
To answer your question, "source object id" is just an arbitrary key I used. You can name your key anything that makes sense to you. It can either be dynamic or predefined - there's no difference functionality-wise.
-
No, I meant to spawn the entire array.
But I made a new system.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login