Sometimes you want to reference ORK stuff in custom scripts. Usually, you do it by ID's but referencing with names would be much simpler.

If you have Odin inspector (https://odininspector.com/) this can be done easily with ValueDropdown attribute.

image

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Sirenix.OdinInspector;

public enum USABLETYPE { Ability, Item }
public class Usable : MonoBehaviour
{

public USABLETYPE UsableType;
[ValueDropdown("UsableID")]
public int ID;

ValueDropdownList<int> UsableID()
{
ValueDropdownList<int> _List = new ValueDropdownList<int>();
string[] _Names = UsableType == USABLETYPE.Ability ? ORKFramework.ORK.Abilities.GetNames(false) : ORKFramework.ORK.Items.GetNames(false);
for (int i = 0; i < _Names.Length; i++)
{
_List.Add(_Names[i], i);
}
return _List;
}
}


If you don't have Odin you can do same with CustomInspector or by generating ORK constants http://forum.orkframework.com/discussion/3336/resource-generating-ork-constants-for-scripting
Sign In or Register to comment.