Search Unity

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

Feature Request Reusable inventory item template

Discussion in 'Economy' started by francesco-included, Jun 23, 2023.

  1. francesco-included

    francesco-included

    Joined:
    Oct 29, 2021
    Posts:
    10
    At the moment, if I want to create 10 different inventory items of the same type, e.g. weapons, you'd have to define manually set the custom JSON for each individual instance with all the item specific properties, e.g. damage, class, durability.

    Ideally, you'd be able to define inventory item templates that can be used to create instances of a generic inventory item with unique property values and they would also propagate any changes to all existing instances of said templates.

    E.g. as a user, I would like to define a Weapon inventory item with a specific set of properties, like damage, durability and class. I would then create a specific weapon inventory item from this template. I would also be able to add/remove/edit properties for an inventory item template and those changes would propagate to the weapons that have already been defined.
     
    amitfid999 likes this.
  2. GabKBelmonte

    GabKBelmonte

    Unity Technologies

    Joined:
    Dec 14, 2021
    Posts:
    81
    Besides my answer here, this sounds a lot like prefabs. Perhaps an alternative would be to export the prefab into an Economy file you can deploy.
     
  3. francesco-included

    francesco-included

    Joined:
    Oct 29, 2021
    Posts:
    10
    How could I export a prefab into an economy file? As far as I can see, you can attach a custom JSON to an economy item, but I don't see how a prefab could be exported into a JSON.

    I realised that items, e.g. weapon, shield, etc, could be defined in Remote Config and then their id could be used to create an Economy item.
     
  4. GabKBelmonte

    GabKBelmonte

    Unity Technologies

    Joined:
    Dec 14, 2021
    Posts:
    81
    That's an interesting workflow.

    The way I would do it would be to have a utility that serializes the prefab into the economy file. It might pass through a DTO if necessary. Of course, you need to be able to have them first, but we'll post something in the forum when its out.