I want to have a reference to an object in a list that won’t break if I add or remove other objects to the list.
I have ScriptableObject
's saved in a List
. These ScriptableObject
s are cards.
Cards are moved from List deck to List player1;
When the card is moved, a canvas image(gameobject) is added to the screen, that pulls the image from the card, however, there is no hard linking to that gameObject
.
_
What I want to do is remove the correct card from the list when it is played.
For the first card, I can use player1.RemoveAt(i);
but this will misalign all the other cards.
I know there MUST be a way, but I can’t find anything.
Thanks for any help