Create buttons with player data (using C#)

Moin :slight_smile:

I want buttons to reflect specific player data.
In this case it is an invisible CardID (BigInt), and two text fields that display the name and card level.

Using the CardID, I would like to read the database so that all cards that have this CardID as ParentID are displayed below
have saved, i.e. all subordinate maps.

This is much easier than assigning each card a single place in the structure, which is intended to be built like a family tree.

Unfortunately, I don’t know exactly how to do this in the best way.
Can I actually assign the three variables I mentioned to a new button?

Kind Regards
Toby

You would assign them to a custom component that lives on the same game object as your button (likely a prefab that you instantiate as you need).

As in, instantiate prefab via the component, assign data to said component, and it modifies the button as necessary.

1 Like

Hey Spiney :slight_smile:

So something like this?

  • Canvas with attached C# Script for data
  • Button
  • Textfield 1
  • Textfield 2

I’m currently working on reading the data from the database
and save them:

Then I have to assign them from there when instantiating.
Before I instantiate the buttons, I will take a closer look at the UI toolkit, which was recommended to me here in the forum.

Thanks for your answer :slight_smile: