Search Unity

How to connect UI with data?

Discussion in 'Scripting' started by leegod, Jun 14, 2021.

  1. leegod

    leegod

    Joined:
    May 5, 2010
    Posts:
    2,476
    Lets say making quest list.

    There will be UI that shows quest list. Maybe quest list is over 10, so there will be page, user go forth and back by page.
    Then its children are UI prefab that should represent each quest.
    And user can select one of them.

    Then how to implement it by clean and simple?

    How to connect each quest data existed on list to each UI prefab generated?

    Add some UIScript to each UI element instantiated? and set each quest info that specific UIScript's variable?

    OR?
     
  2. MAx2L

    MAx2L

    Joined:
    Oct 20, 2019
    Posts:
    5
    i'd use scriptable objects for the quests , defining the title the description and maybe the reward.
    you'd need a questlog script to handle the objects and create prefabs and pages accordignly.