Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Feature Request Ability to add strings as details or stats

Discussion in 'Game Foundation' started by Pepperoni92, Dec 16, 2019.

  1. Pepperoni92

    Pepperoni92

    Joined:
    Oct 26, 2014
    Posts:
    11
    A simple use case for this would be to provide a description of the item so it can appear in an in game store.

    Also, it could be used to store identifiers for other items. For example, if I have multiple currencies and want to add a cost to an item, right now my only option is to create multiple stats for each currency type. i.e. foodCost, woodCost, goldCost, gemCost, etc
     
  2. mingz-unity

    mingz-unity

    Unity Technologies

    Joined:
    Oct 12, 2017
    Posts:
    63
    Thanks for the feature request @Pepperoni92. I can definitely see how this can be useful.

    The workaround of using Stats system for that purpose might work but could be sub-optimal,
    since the stats system stores stats value as part of the instance data, while these properties you mentioned should be mostly static (i.e. doesn't change at runtime), so there's more runtime overhead using Stats. Detail would indeed be a better choice.

    Please check out the Custom Detail feature we just launched in 0.2.0 package last week, which allows you to define your own Detail and then use it like our built-in ones. This might help you in the meanwhile.

    Also, a clarifying question for your feature request: you asked for 'adding strings' but the later examples you gave (wood costs etc.) are mostly numeric values. Should I understand this as allowing multiple data types rather than just string?
     
    erika_d likes this.
  3. Pepperoni92

    Pepperoni92

    Joined:
    Oct 26, 2014
    Posts:
    11
    Aha! Thank you. The CustomDetail feature is exactly what I'm looking for. I can make a custom detail for a a string or other things I need connected to that inventory item. This doc looks pretty straight forward. I'll give it a try.

    Ideally, different data types would be supported but it looks like the CustomDetail feature lets me do that. In my example, I was planning on putting the term "food" into the inventory item, so then I could then look it up dynamically in code and make sure the correct currency was being used.
     
    erika_d and mingz-unity like this.