If you know what type of object you are spawning, then all you have to do is create a variable of the same type. No casting needed. Same thing when you get the item from the array.
If you know what type of object you are spawning, then all you have to do is create a variable of the same type. No casting needed. Same thing when you get the item from the array.