Search Unity

How to change element list name on inspector like "item_name ID:0"

Discussion in 'Immediate Mode GUI (IMGUI)' started by toonyoza, May 17, 2019.

  1. toonyoza

    toonyoza

    Joined:
    Aug 30, 2017
    Posts:
    1
    How can i change element list name on inspector like "item_name ID:0"
    i know how to change element name but just want add something like ID item by index Arrary Element on inspector
    just want a sample what should i script PropertyDrawer or Editor and how it work ?

    here this script variable
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4.  
    5.  
    6. public class ItemDatabase : MonoBehaviour {
    7.  
    8.     public ItemDatabaseElement[] itemdata = new ItemDatabaseElement[5];
    9. }
    10.  
    11.  
    12. [System.Serializable]
    13. public class ItemDatabaseElement{
    14.     public string ItemName = "";
    15.     public Sprite ItemSprite;
    16.     [TextArea(3,10)]
    17.     public string ItemDetail = "";
    18.     public int ItemPrice = 0;
    19.     public bool Useable=false;
    20.     public bool Consumable=false;
    21.     public float CoolDown=1.0f;
    22.     public int MaxPerStack = 99;
    23.  
    24.  
    25.     public SelectionType ItemType;
    26.  
    27.     public GameObject EffectOnUse;
    28.  
    29. }
    30.  
    31. public enum SelectionType { food, consumable, ammo, tool, seed, metarial, ect }
    32.  


    thank you for your help.