IDString - BluePixelDev/utilkit GitHub Wiki

IDString is a serializable wrapper for a string with auto-formatted ID logic.

Overview

This class ensures a clean, space-free ID by automatically replacing spaces with underscores during serialization or assignment.

Features

  • Auto-replaces spaces with underscores in the string
  • Serializable in Unity
  • Implicit conversion to string

Code Example

IDString myID = new IDString("My Custom ID");
Debug.Log(myID); // Outputs "My_Custom_ID"

Members

Fields

  • private string id — the internal string representation.

Properties

  • string ID — gets or sets the ID. Trims leading whitespace and replaces spaces with underscores.

Methods

  • implicit operator string(IDString) — allows implicit conversion to string.