Home > Back-end >  How to reference a prefab
How to reference a prefab

Time:07-16

public Gem gem;
public int coins;
public static SaveSystem instance {get;  private set;}
void Awake()
{
    coins = gem.LastCoins;
}

The "Gem" here means the Gem script and ofcourse the gems here are an prefabs , so how i can reference it in the inspector or in script

CodePudding user response:

Without more context, the solution would be to drag the Prefab from the 'Project' Tab into the 'gem' field in the Inspector of the object with the script attached.

  • Related