How to activate a function (or equivalent) in a specific gameobject

I am trying to send data from Shuffle into GooCardScript. GooCardScript will be found within 5 different GameObjects, but I only want one of them to receive the data. From what I can tell, SendMessage and BroadcastMessage do not differentiate between objects.

Here is the script that sends data:

using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;

public class Shuffle : MonoBehaviour
{
    // calls my data objects
    public SpawnDeckList SpawnDeckList;
    public SpawnManagerScriptableObject SpawnManagerScriptableObject;

    // temp variables
    public bool[] GooCard = new bool[5];

    // varibles for deck sorting
    int TopCard = 0;
    int GooEmpty = 5;

    // Start is called before the first frame update
    void Awake()
    {
        // temp variable definations
        GooCard[0] = true;
        GooCard[1] = true;
        GooCard[2] = true;
        GooCard[3] = true;
        GooCard[4] = true;

        // code here to decide what decks are chosen

        // merging the decks the plays choose into Deck
        int[] Deck = new int[SpawnDeckList.SpindleDeck.Length + SpawnDeckList.SpindleDeck.Length];
        Array.Copy(SpawnDeckList.SpindleDeck, Deck, SpawnDeckList.SpindleDeck.Length);
        Array.Copy(SpawnDeckList.SpindleDeck, 0, Deck, SpawnDeckList.SpindleDeck.Length, SpawnDeckList.SpindleDeck.Length);

        // shuffling Deck
        int tempDeck;
        for (int i = 0; i < Deck.Length; i++)
        {
            int rnd = UnityEngine.Random.Range(0, Deck.Length);
            tempDeck = Deck[rnd];
            Deck[rnd] = Deck*;*

Deck = tempDeck;
}

// making sure nothing is broken
Debug.Log("first cards that appear in the goo are numbers ");
for (int i = GooEmpty; i > 0; i -= 0)
{
Debug.Log(Deck[TopCard]);
MakeCard(Deck[TopCard]);
TopCard += 1;
GooEmpty -= 1;
i -= 1;
}
Debug.Log("TopCard is " + TopCard);
Debug.Log("GooEmpty is " + GooEmpty);
}
// this is the important part
// this is the important part
// this is the important part
// make the card with the stats
void MakeCard(int CardID)
{
* if (GooCard[0] == false)*
* {*
* // insert code to message GooCard1 with the info*
* }*
* else if (GooCard[1] == false)*
* {*
* // insert code to message GooCard2 with the info*
* }*
* else if (GooCard[2] == false)*
* {*
* // insert code to message GooCard3 with the info*
* }*
* else if (GooCard[3] == false)*
* {*
* // insert code to message GooCard4 with the info*
* }*
* else if (GooCard[4] == false)*
* {*
* // insert code to message GooCard5 with the info*
* }*
* else*
* {*
* Debug.LogError(“<color=red>Error: Either all GooCards are full and the GooEmpty was mistakenly called, or at least one of the GooCards are listed as full when they aren’t”);*
* }*
}

// Update is called once per frame
void Update()
{

}
}
The script receiving data:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GooCardScript : MonoBehaviour
{
// calls my data objects
public SpawnDeckList SpawnDeckList;
public SpawnManagerScriptableObject SpawnManagerScriptableObject;
private SpawnManagerScriptableObject.Card PersonalStats;

// temp variables
public bool[] Card = new bool[5];
public int Player = 1;

// Start is called before the first frame update
void Start()
{
// temp variable definations
Card[1] = true;
Card[2] = true;
Card[3] = true;
Card[4] = true;
}
// the function I want to activate
void ReciveStats(SpawnManagerScriptableObject.Card Stats)
{
Stats = PersonalStats;
// insert code to apply sprite and cost
}

// Update is called once per frame
void Update()
{
if (Input.GetMouseButtonDown(0))
{
if (Player == 1)
{
if (Card[0] == false)
{
// insert code to message Card1 with the stats
}
else if (Card[1] == false)
{
// insert code to message Card2 with the stats
}
else if (Card[2] == false)
{
// insert code to message Card3 with the info
}
// so on and so forth
else
{
Debug.LogError(“<color=red>Error: Either I messed up the script or you somehow have 120 cards on one side and you want more, if the ladder is true, I quit”);
}
}
}
}
}
Notes / Clarifcation:
The GooCardScript will save the data, then send the data to a different GameObject later. Those GameObjects will all have the same script and I plan to use the same method I receive here. There will be 240 of these GameObjects, so it will be a long a tedious process to make a unique script with unique functions for each one.

If you’re wanting to send data to a specific card, I would do 2 things. First, implement the suggestion that @unity_ka6jgzfPPmtNCw made and add a new function to your GooCardScript called “TransferData” (or whatever you like), then add to the parameters whatever data you want to send. So something like this:

void TransferData(Data data)
{
    print ("Received " + data);
}

Second, add a new variable in your Shuffle script which stores all of your GooCardScript objects. From there, if you want to send the data to a particular card, call that card’s TransferData function. So let’s say you wanted to send the data to card 3 (keeping in mind that the number starts at 0, this would make card 3 the fourth card in the array), it might look like this:

GooCardScript[] cards = new GooCardScript[5] // You can also use a List instead of an array

void Start()
{
    card[3].TransferData(data);
}