概要
using System.Reflection; using UnityEditor; using UnityEngine; public static class Example { [MenuItem( "Tools/Hoge" )] private static void Hoge() { var rectTransform = ( RectTransform ) Selection.activeTransform; var type = typeof( RectTransform ); var propertyInfo = type.GetProperty( "drivenProperties", BindingFlags.Instance | BindingFlags.NonPublic ); var drivenProperties = propertyInfo.GetValue( rectTransform ); Debug.Log( drivenProperties ); } }
リフレクションを使用して drivenProperties プロパティを参照する
例えば ContentSizeFitter の Horizontal Fit が設定されている RectTransform の場合
SizeDeltaX が「Some values driven by XXXX」の対象になっていることが確認できる