Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Null a Transform Array

Im having a problem figuring out the structure for this.

I want to instantiate a Transform thats located inside an Array and then delete it x amount of seconds later. But i need to null that specific location in the Array straight after i instantiate it.


Its basically dropping a weapon in an Inventory System i made and picking one up straight away replacing the old item.

Comments

  • This sounds like maybe it would maybe benefit from being a List instead of an Array. I'm not sure of your system though, so use whatever works best, but lists don't need to have a set amount of objects in them like an array. For example you could have one inventory item in your list, and when the player uses it you can remove it from the list, and the list will have 0 objects within it, instead of having to make a spot null.

    If you do need to use the Array, you can just set that slot equal to null.

    myArray[1] = null;
    
  • TorzaTorza Member

    Ahh thank you for that. That would make more sense to use a list in this scenario. Ill try that

Sign In or Register to comment.