WienerWiener
  • Introduction
  • Comparison
  • Pricing
  • FAQ
  • Use Cases
  • License
  • Unity Asset vs Standalone
  • Obfuscation & Tamper Detection
  • Mismatch Detection & Debug
  • Localization
  • Versioning
  • Google Sheets Input
  • Excel
  • YAML
  • Settings
  • Data Format
  • Convert
  • ValueOnly Format
  • Startup
  • Samples
  • Converter
  • YAML Editor
  • Setting Editor
  • 日本語
  • English
  • Introduction
  • Comparison
  • Pricing
  • FAQ
  • Use Cases
  • License
  • Unity Asset vs Standalone
  • Obfuscation & Tamper Detection
  • Mismatch Detection & Debug
  • Localization
  • Versioning
  • Google Sheets Input
  • Excel
  • YAML
  • Settings
  • Data Format
  • Convert
  • ValueOnly Format
  • Startup
  • Samples
  • Converter
  • YAML Editor
  • Setting Editor
  • 日本語
  • English
  • Samples

    • Samples
    • Convert the 2.2-Million-Cell Sample Data
    • Create the Item Master
    • Experience Hot Reload
    • Create the Unit Master
    • Create the Reward Master
    • Create the Equipment Master
    • Try Localization
    • Add Keys to Existing YAML

Add Keys to Existing YAML

Preparation Before Starting the Sample

  • Unity Startup is complete
  • Create the Item Master is complete
  • Create the Unit Master is complete
  • Create the Equipment Master is complete

Overview

This sample adds keys to existing Excel files and YAML files.
After adding the keys, confirm that the added description and icon ID can be referenced from C# code based on the existing reward display sample.

Keys to Add

  • Item: IconId
  • Unit: Description, IconId
  • Equipment: Description, IconId

Steps:

  1. Edit the Excel data files
  2. Edit YAML
  3. Convert
  4. Runtime check

Edit the Excel Data Files

Add columns to the existing Excel files.
Enter column names in snake_case.

Item.xlsx

Add IconId at the far right.

Image from alias

int	string	string	item_type	int	int	int
id	name	description	type	value	sale	icon_id
0	Invalid		None	0	0	0
1000000001	Potion (S)	Restores a small amount of HP	Recovery	100	10	1001
1000000002	Potion (M)	Restores HP	Recovery	300	50	1002
1000000003	Potion (L)	Restores a large amount of HP	Recovery	1000	100	1003
1010000001	Power Up (S)	Slightly increases Power	Buff	1	20	1101
1010000002	Power Up (M)	Increases Power	Buff	3	40	1102
1010000003	Power Up (L)	Greatly increases Power	Buff	6	80	1103
1020000001	Koban	Can be sold at shops for a high price	SellOnly	0	1000	1201
1020000002	Oban	Can be sold at shops for a high price	SellOnly	0	5000	1202

Unit.xlsx

Add Description to the right of Name, and add IconId at the far right.

Image from alias

int	string	string	int	int	int	int	int	int
id	name	description	hp	attack	defense	magic	growth_pattern_id	icon_id
1000000001	Hero	Leader of the party	1000	800	800	600	1200000001	2001
1000000002	Skilled Warrior	A balanced front-line fighter	800	600	600	400	1200000001	2002
1000000003	Heroine	A magic user with high support power	500	200	400	800	1200000002	2003
1000000004	Villager A	A villager who helps at the beginning	400	300	200	50	1200000002	2004
1000000005	Soldier King	A powerful unit with high attack	900	800	700	100	1200000001	2005

Equipment.xlsx

Add Description to the right of Name, and add IconId at the far right.

Image from alias

int	string	string	rarity_type	equipment_part	int	int	int
id	name	description	rarity	part	atk	def	icon_id
0	Invalid		None	None	0	0	0
2000000001	Bronze Sword	A basic sword for beginners	Common	Weapon	12	0	3001
2000000002	Iron Helm	A sturdy iron helmet	Common	Head	0	8	3002
2000000003	Knight Armor	Armor used by royal knights	Rare	Body	0	24	3003
2000000004	Power Gloves	Gloves that increase attack	Rare	Arm	6	5	3004
2000000005	Swift Boots	Boots that help quick movement	Rare	Leg	0	10	3005
2000000006	Dragon Charm	A charm with dragon power	Epic	Accessory	18	18	3006
2000000007	Excalibur	A legendary sword	Epic	Weapon	45	0	3007

Edit YAML

Use YamlEditor to add fields to the existing YAML files.

Open YamlEditor

Select Tools > Wiener > Open Yaml Editor to open YamlEditor.

Image from alias

Edit item.yaml

Open item.yaml and press the Add Field button to add a key to fields.

Image from alias

Change the items as follows, then press the Save button.

  • key: IconId
  • name: icon_id
  • type: Int

Image from alias

Edit unit.yaml

Open unit.yaml and press the Add Field button twice to add keys to fields.

Image from alias

Change the items as follows.

Description

  • key: Description
  • name: description
  • type: String

IconId

  • key: IconId
  • name: icon_id
  • type: Int

Image from alias

Select Description, press the Move Up button to move it below Name, then press the Save button.

Image from alias

Edit equipment.yaml

Apply the same changes as unit.yaml.

Description

  • key: Description
  • name: description
  • type: String

IconId

  • key: IconId
  • name: icon_id
  • type: Int

Image from alias

Convert

Open Converter

Select Tools > Wiener > Open Converter to open Converter.

Image from alias

Run Conversion

Press Run Develop to run conversion and confirm that no errors occur.

Image from alias

Runtime Check

Create the following Reward.cs and Sample.cs scripts, attach them to the scene, and confirm that logs are output correctly.
This code is based on the reward sample and displays the description and icon ID.

Reward.cs

using Wiener;

namespace Wiener
{
    interface IRewardData
    {
        string Name { get; }
        string Description { get; }
        int IconId { get; }
    }

    public partial class ItemData : IRewardData {}
    public partial class UnitData : IRewardData {}
    public partial class EquipmentData : IRewardData {}
}

public class Reward
{
    public int Id { get; private set; }
    public RewardType Type { get; private set; }
    public int Count { get; private set; }
    public string Name => _rewardData?.Name ?? "";
    public string Description => _rewardData?.Description ?? "";
    public int IconId => _rewardData?.IconId ?? 0;

    private IRewardData _rewardData;

    public Reward(WienerManager wienerManager, int id, RewardType type, int count = 1)
    {
        Id = id;
        Type = type;
        Count = count;
        _rewardData = type switch
        {
            RewardType.Item => wienerManager.Item.TryGetValue(id, out var item) ? item : null,
            RewardType.Unit => wienerManager.Unit.TryGetValue(id, out var unit) ? unit : null,
            RewardType.Equipment => wienerManager.Equipment.TryGetValue(id, out var equipment) ? equipment : null,
            _ => null
        };
    }
}

Sample.cs

using UnityEngine;
using Wiener;
using WienerLib;

public class Sample : MonoBehaviour
{
    void Start()
    {
        var wm = new WienerManager();
        var textAsset = Resources.Load("basic") as TextAsset;
        var result = wm.LoadBasicPack(textAsset.bytes);
        if (result != Result.Success)
        {
            Debug.LogError($"Failed to load basic pack: {result}");
            return;
        }

        OutputReward(wm);
    }

    void OutputReward(WienerManager wm)
    {
        foreach (var rewards in wm.Reward.Values)
        {
            foreach (var reward in rewards)
            {
                var r = new Reward(wm, reward.RewardId, reward.RewardType, reward.RewardCount);
                Debug.Log($"GroupId: {reward.GroupId}, Name: {r.Name}, Description: {r.Description}, IconId: {r.IconId}, Id: {r.Id}, Type: {r.Type}, Count: {r.Count}");
            }
        }
    }
}

Result

Image from alias

Last Updated:: 6/15/26, 11:32 AM
Contributors: artisan-sawasaka
Prev
Try Localization