Я создал ScriptableObject, но, к сожалению, не могу назначить ему созданный мной класс. Что делать?
Коды
CardScript
Screenshot
I've tried to do something like this but now i cannot add script to the card gameobject
public class CardDisplay : MonoBehaviour
{
public Card card;
public TextMeshProUGUI nameText;
public TextMeshProUGUI descText;
public TextMeshProUGUI APText;
public Image cardbackground;
public Image artworkImage;
public Image maskImage;
public void SetProperties()
{
///To take a data from localizer. Shalalalaaaa.
var NameText = LocalizationSettings.StringDatabase.GetLocalizedStringAsync("CARD_NAME", card.Key);
NameText.Completed += (op) => nameText.text = op.Result;
var DescText = LocalizationSettings.StringDatabase.GetLocalizedStringAsync("CARD_DESC", card.Key);
DescText.Completed += (op) => descText.text = op.Result;
APText.text = card.ActionPoint.ToString();
if (card.Artwork != null)
artworkImage.sprite = card.Artwork;
cardbackground.sprite = Resources.Load<Sprite>("Items/Card/CardBackgrounds/Card_"+card.rarity);
maskImage.sprite = Resources.Load<Sprite>("Items/Card/CardMasks/"+ card.rarity +"_Mask");
foreach (CardScript a in Resources.LoadAll<CardScript>("Items/Card/CardScripts"))
{
Debug.Log(a.name);
}
if(Resources.Load<CardScript>("Items/Card/CardScripts/"+card.Key) != null)
gameObject.AddComponent(Resources.Load("Items/Card/CardScripts/"+card.Key).GetType());
}
}