概要
using System.Reflection; using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { const string name = "GetBuildTargetGroupDisplayName"; const BindingFlags attr = BindingFlags.Static | BindingFlags.NonPublic; var buildTarget = EditorUserBuildSettings.activeBuildTarget; var buildTargetGroup = BuildPipeline.GetBuildTargetGroup( buildTarget ); var parameters = new object[] { buildTargetGroup }; var type = typeof( BuildPipeline ); var methodInfo = type.GetMethod( name, attr ); var displayName = ( string ) methodInfo.Invoke( null, parameters ); Debug.Log( displayName ); } }
PC, Mac & Linux Standalone
などの文字列を取得できる