概要
using System.CodeDom.Compiler; using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var provider = CodeDomProvider.CreateProvider( "C#" ); Debug.Log( provider.IsValidIdentifier( "name" ) ); // True Debug.Log( provider.IsValidIdentifier( "@name" ) ); // True Debug.Log( provider.IsValidIdentifier( "1name" ) ); // False Debug.Log( provider.IsValidIdentifier( "name-name" ) ); // False Debug.Log( provider.IsValidIdentifier( "if" ) ); // False } }