- Home /
Importing and using custom assets
I have created a custom unity asset which contains a deck of cards. Each deck asset has two main elements, it's name and size, then it's elements. Each element represents a card and has variables related to each card. Now I have created each asset fine, my problem is when I try to use these assets in my game.
It is a card game so my main question is how can I take a deck asset and shuffle it then deal what ever is on top of it? I've looked at shuffling and dealing scripts, I understand how they work, but I really don't know how to apply shuffling or dealing to my asset. Mainly I don't know how to interact with the data in my asset.
What I was thinking of was something like this for loading in my asset.
GameObject go = Resources.Load(_deckName, typeof(Deck));
Deck retrievedDeck = go;
return retrievedDeck;
Although once I have it in I'm not really sure how to go through the assets. If the above works for importing the asset can I go through the elements like an array or a list? Or is it another thing completely?
Your answer
Follow this Question
Related Questions
AddObjectToAsset (reference) becomes null 1 Answer
Why unity can't create/save asset (ScriptableObject ) at runtime ? 1 Answer
How to get the asset file from the AssetDatabase.CreateAsset() 1 Answer
Prefab as a subasset of a ScriptableObject 0 Answers
Custom assets give Missing (Mono Script) 0 Answers