Greetings, I’m trying to make a small card game and I have some questions:
I’ve made a prefab of a blank card, and I want to fill it with text for several cards, whats the best approach? Creating every card png? Or having a script attached to the card that changes every attribute I wanted? and If so, how would I write the text over image?
The standard 3DText gameObject (in code called a TextMesh) does a nice job of putting text on something in the game world. Can display arbitrary strings, but no internal format changes (like bolding one word.) Lots of questions/answers about it here (like see-through-ness and multiple lines.)
Ask ten programmers/designers/people for the “best approach” will likely get you eleven answers. Here are mine!
I like relational databases. Your “card” will likely be made up of several elements (correct me if I’m wrong, please), like a Title/Name, an image or bacground, some text, maybe even some integral variables that show current health or attack or something. All of these can be tracked many ways, but I would suggest a database that will allow you to get all of these parts and apply them to the default prefab instance of a card in Unity.
Prefab is basically “Blank” and, at instantiation, gets its attributes applied via the database ID/primary key.
This, by my reckoning, will give you the best way to simulate finite decks and random draws.