how do i instantiate prefab and load its data from scriptable object .,i want to instantiate prefab and load its asset right away.

hello . i am new to unity and trying to create a TCG kind of game.
the problem that i am facing now is to instantiate my prefab and load its asset at single click.

this is my script attached to the card prefab

public class CardData : MonoBehaviour
    public SOcard socard; //scriptableobject script

    public string TitleData;
    public Image CardImageNormalData;
    public int PowerData;
    public int ResistanceData;
    public Sprite CardImageLargeData;

    void Start()
    public void LoadCardData(SOcard spawncard)
        socard = spawncard;

        TitleData = socard.Title;                                         
        CardImageNormalData.sprite = socard.CardImage;
        PowerData = socard.Power;
        ResistanceData = socard.Resistance;
        CardImageLargeData = socard.CardImageLarge;


next is script attached to deck

public class DeckLogic : MonoBehaviour
    public List<SOcard> card = new List<SOcard>();
    public SOcard socard;  //scriptableobject script
    public CardData CardTransfer;

    void Awake()
        CardTransfer = FindObjectOfType<CardData>();
        socard = card.ElementAt(0);

    public void addthiscard()
        var SpawnCard = socard;


and script to my start button.

public class Instantiatetest : MonoBehaviour, IPointerClickHandler
    private DeckLogic decklogic;
   void Start()
        decklogic = FindObjectOfType<DeckLogic>();
    public void OnPointerClick(PointerEventData eventData)
        GameObject card = Instantiate(Resources.Load("Card", 
        typeof(GameObject))) as GameObject;

    void loadcard()

my idea is to click and instantiate card prefab at then transfer the first scriptableobject info from deck to that instantiated card prefab.
when i clicked start button, i got this error;

gameobject reference is not set to an instance of an object.

if i created instance of the card prefab before transferin the info, it works. so i came to conclusion that both this code

`GameObject card = Instantiate(Resources.Load(“Card”, typeof(GameObject))) as GameObject;



are executed at same time.

so now i am trying to find solution to execute the code in sequence.

or maybe i have wrong idea on how this works. im asking for any suggestion.

thanks in advance.

thanks. this is solved. with this simple code. pls forgive me for my noob question. still new to unity.

// my scriptable object script eg.
public string Name;
public int Power;
public int Defense;

//this script below is attached to start button
// i am using event system here for click

public GameObject AnyPrefab; //attach any prefab here from inspector
public ScriptableObject CardData;//this is just example here. this can be accessed somewhere else maybe

public void OnpointerClick(PointerEventData eventData)
       var NewCard  = instantiate(AnyPrefab);

//this script name below is CardScript which is attached to the prefab that i reference to AnyPrefab.

public string Name;
public int Power;
Public int Defense;

public void LoadCardData (ScriptableObject CardData )
        Name = CardData.Name;
        Power = CardData.Power;
        Defense = CardData.Defense;