Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to select a value from an IVariable?

Discussion in 'Localization Tools' started by doodlinbee, Nov 28, 2023.

  1. doodlinbee

    doodlinbee

    Joined:
    Feb 15, 2020
    Posts:
    27
    Let's say I have an Item class that has a name and an number.

    Is there a way that I can select specific properties? I'd like to do something like this
    upload_2023-11-28_20-50-15.png
    and I would like that this shows the item's name and then it's number.
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,147
    You could create a variable that returns a struct/class with those fields inside.
    Take a look at some of the examples here
    https://docs.unity3d.com/Packages/c...manual/Smart/Persistent-Variables-Source.html

    Your custom variable would return an instance of the class and you can then access the fields using the normal reflection source.

    Alternatively you could just pass in an instance of the class into the localized string Arguments.
     
    doodlinbee likes this.