RockTomate / Issues

Submit bugs and feature requests.
4 stars 1 forks source link

[Feature] Path selector button #22

Open BaalEvan opened 3 years ago

BaalEvan commented 3 years ago

Feature Proposal Add optional parameter to string fields that allow using the additional button for file selection.

Problem this Solves For example in BuildPlayerStep there is AssetBundleManifest Path, with the button we would be able to select a specific file instead of copying path from the explorer

Working example in attached video (but i don't like how i made it)

  public class StringDrawer : FieldDrawer<string>
    {

        /// <inheritdoc />
        protected override string OnRender(GUIContent content, string value, FormulaCollection formulaCollection)
        {
            value = EditorGUILayout.TextField(content, value);
            if (content.text.ToLower().Contains("path"))
            {
                if (GUILayout.Button("Select path"))
                {
                    value = EditorUtility.OpenFilePanel(value, "", "");
                }
            }

            return value;
        }

https://user-images.githubusercontent.com/1843494/123984716-26f04f80-d9c5-11eb-84c4-0a04e19c8a31.mp4

ElmarTalibzade commented 3 years ago

Thanks a lot for the suggestion! I like the idea but I don't want this to show up for all string field types.

I am working on adding custom fields including file/folder browser which should address your concerns.