Trouble code to interact with PREFABS after spawning

Hello!
I am trying to make a card game, and so far I have a “Card Manager” empty with a similarly named code inside of it. I intend to have this empty spawn blank cards into the scene, tell them what sprite to wear, and transform their position from your hand and into play when used. So far I can spawn them alright, but what I am using for the cards is a prefab.
This prefab has a script that holds an array of sprites I might what them to wear, but when I try to change the array value in the prefab’s script with my Card Manager… Well I can’t reference it because It’s not in the scene. I tried having my Card Manager change a int value in the prefab, which it did. But even after I instantiated it after changing said number, it would still just set the value to one on the spawned version for mysterious reasons. (YET AGAIN I COULD SEE IT CHANGE IN THE PREFAB IN MY ASSET FOLDER AS I RAN MY CODE)
I’d rather not custom make every card in MS paint and have 100 blank game Objects sitting around off screen just to turn them into cards (since I intend to potentially have the games last multiple decks) but I just cant find a good way to bind the code of my prefab to my Card Manager.

If anyone knows ANYTHING please tell me. If there is a better way I can’t seem to figure it out by myself and brackeys has way too much content to sift through when I don’t even know the terms I’m looking for.

Hi,

What about storing the spawned cards inside your CardManager ?
I suppose you’re spawning cards by doing : Instantiate(cardPrefab, position, rotation);
And you can use this to get the reference of the spawned object :

Card card = Instantiate(cardPrefab, position, rotation);
card.ChangeSprite(selectedIndex);

Something like this. Be careful though : this assumes that the cardPrefab you serialized is a custom script called “Card”. You can choose to serialize a GameObject, and Instantiate will return a GameObject type.

You could also store every card you spawn into a Collection, and therefore being able to work on every card you instantiate.
I hope this is the answer you’re looking for?