How to use only 1 data structure(Stack /List) to pop out items for multiple objects;

I one script i have a public List Name … This contains sprites.In the script i have a sub(with parameters ( public void MakeCard(float x, int y, int z)) which instantiates an object. In the sub i assign a random sprite to the object and the sprite is removed from the list so it does not repeat.

I call this sub in 2 other scripts with 2 different game objects however the cards repeat because it uses a fresh List. when i spawn them. Is there any way i could make both of the gameobjects use only 1 list so the cards do not repeat .Thanks

Hello @AleksND !
Lets say the name of the list is “sprites” and the name of the script is “SpriteScript”, then you would access the list from another scripts by doing typing this to a different script:

SpriteScript script = gameObject.GetComponent<SpriteScript>();
Debug.Log(script.sprites.Count);