void SelectPropertyID(FxSpriteSelector target) { using (var c = new EditorGUI.ChangeCheckScope()) { selectedPropertyID = EditorGUILayout.Popup("Property", selectedPropertyID, Properties.ToArray()); if (c.changed) { Undo.RecordObject(target, "Change Property"); EditorUtility.SetDirty(target); target.Property = Properties[selectedPropertyID]; target.SetSprite(target.SpriteID); } } }
void GetPropertyPopup(FxSpriteSelector target) { Properties.Clear(); var r = target.GetComponent <Renderer>(); if (r.sharedMaterial) { var shader = r.sharedMaterial.shader; var c = ShaderUtil.GetPropertyCount(shader); for (int i = 0; i < c; i++) { if (ShaderUtil.GetPropertyType(shader, i) == ShaderUtil.ShaderPropertyType.TexEnv) { Properties.Add(ShaderUtil.GetPropertyName(shader, i)); } } } selectedPropertyID = Properties.FindIndex(t => t == target.Property); }