Users want to be able to easily select and change the Name.
The system needs a unique ID that will never change.
IDReference satisfies the exact opposite requirements of the user and the system.
Just select from the pull-down menu and you won't make a mistake.
[SerializeField, CharacterIDReference] string characterID;
//Inspector:Cat 猫 characterID:IDRef-Character-iwp05The dedicated panel makes it easy to modify.
- Changing the name does not affect the reference in the destination.
- Changing the order will not affect the reference in the destination.
- Using a language other than English is not a problem.
The dedicated panel makes it easy to modify.
- Show all references
- Jump to references
- Print reference
https://github.com/IShix-g/IDReference.git?path=Assets/Plugins/IDReference
Add the Url to Package Manager
#if UNITY_EDITOR
using UnityEditor;
using IDRef;
// [Step1] Initialization (editor only)
[InitializeOnLoad]
public sealed class IDReferenceSetting
{
static IDReferenceTable characterTable;
static IDReferenceSetting()
{
characterTable = new IDReferenceTable("Character", false, false);
IDReferenceProvider.SetTable(characterTable);
}
}
#endifusing IDRef;
public sealed class CharacterIDReferenceAttribute : IDReferenceAttribute
{
public override string GetTableID() => "Character";
}using UnityEngine;
public sealed class IDReferenceTest : MonoBehaviour
{
[SerializeField, CharacterIDReference] string characterID;You can access the ID reference list by adding a custom menu.
It is useful to have it set up.
static IDReferenceTable characterTable;
static IDReferenceSetting()
{
characterTable = new IDReferenceTable("Character", false, false);
IDReferenceProvider.SetTable(characterTable);
}
// Add to menu
[MenuItem("IDReference/Character")]
public static void CharacterCustomMenu()
{
characterTable.ShowSettingDialog();
}
- Multiple registrations are also possible.
- All of this is only available in the Unity Editor.
- The initialization code must be enclosed in
UNITY_EDITOR.- Do NOT enclose the Attribute code in
UNITY_EDITOR, as it will be referenced by other classes.
If you delete an ID, you can no longer reference that ID. This is the only weakness of IDReference.
If you disable the delete button, you can sleep easy knowing that the reference will never be corrupted :)
characterTable = new IDReferenceTable("Character", disableRemoveButton: true);By disabling add ID in the drop-down, you can make it so that only you can edit it.
characterTable = new IDReferenceTable("Character", disableDropDownAddID: true);By setting initial values, you can set your own ID. The added ID cannot be deleted or edited and is displayed in blue text.
characterTable = new IDReferenceTable("Character", required: new []{ new IDReference("Mob モブ", "Mob") });Editor only.
If IDs alone are difficult to understand, you can use ToIDReferenceEditorOnly() to convert the string into an IDReference Object.
using UnityEngine;
public sealed class IDReferenceTest : MonoBehaviour
{
[SerializeField, CharacterIDReference] string characterID;
void Start()
{
#if UNITY_EDITOR
// convert to IdReference
var idReference = characterID.ToIDReferenceEditorOnly();
if (idReference.IsValid())
{
var name = idReference.Name;
var id = idReference.ID;
Debug.Log($"Name:{name} ID:{id}");
// Name:Cat 猫 ID:IDRef-Character-iwp05
}
#endif
}
}Shift_JIS support.
It is assumed that the settings are made from the Unity inspector.
| IDReference | int | string | enum | |
|---|---|---|---|---|
| Rename | Excellent | Poor | Poor | Excellent |
| Reorder | Excellent | Fair | Fair | Fair |
| Use | Excellent | Poor | Poor | Excellent |
| Understandability | Excellent | Poor | Excellent | Excellent |
| Reference check | Excellent | N/A | N/A | N/A |
Character / Item / Monster / Story
- stevehansen/csv
I use it for importing and exporting CSV.













