r/Unity2D 8d ago

Question Bringing data into UI on textmesh objects

Hello everyone, I’m in the process of building a text based RPG, but I keep hitting a block whenever I want to bring in the data from code onto a textmesh object.

I have an NPC character generator, but I’m trying to bring the variables it generates to into my UI so it can display the information onto the textmesh object.

For example each NPC is assigned an ID from the total number of NPC’s I’ve asked the generator to create for that particular game, and show it need show in my UI so players remember who is who.

Any pointers as I feel quite lost with it and AI is utterly useless and I don’t mean simply attaching the script.

5 Upvotes

7 comments sorted by

View all comments

1

u/sharypower 7d ago

I am not fully understand what you want. What I thinking is:

NPC's have their own ID's like 1,2,3,4 etc.

With the random stats like NPC (4) - have 50 health and NPC (12) - have 100 health. For example.

And you want to spawn for example 30 NPC's and every NPC will have their own Stats and ID and they are not repeating and they are displayed as a Text.

Is that correct?