Inline Editor Aware

Issue #122 resolved
Steamroller Studios created an issue

Here is an example of what I'm trying to accomplish

I have a ScriptableObject that i want to provide buttons for when filling out the data on the object (ie. update something on the ScriptableObject based on selection)

then when i reference that ScriptableObject on another component, I'm using the [InlineEditor] which allow the user to verify the data they have selected.

It would be cool if those buttons that i provided when first creating the object where not exposed when shown via the InlineEditor.

One way that i could see this working is that if in a [ShowIf] and [HideIf] you could query if you were being shown via an [InlineEditor]. Maybe a function that could be called that returned the InlineEditor depth... just a thought

It would also be cool to have the ability to set something to [ReadOnly] when its Inline as well so the user doesn't accidentally change values without knowing.

Comments (6)

  1. Steamroller Studios reporter

    Please let me know if you need me to better explain this cause i know what i described above maybe a little confusing

  2. Tor Esa Vestergaard


    We're currently attending the Unite Europe conference in Amsterdam, and so we can't get back to you immediately regarding this - it does look feasible though, and isn't a bad idea. We'll definitely look into this once we get back home.

    Cheers, and thanks for the suggestion!

  3. Johannes P.

    This interests me as well.

    Perhaps via new attributes such as [HideIfNested], [ReadOnlyIfNested] or [DisableIfNested], etc. that could take an optional argument for how many nesting levels it will be before the given field is Hidden/Disabled/etc. so you could see a button when references in one [InlineEditor] but not if viewed nested deeper.

    The alternative Tor mentioned, having a function you can query to see what depth you are being drawn at, would also work, and may be useful to have regardless.

  4. Tor Esa Vestergaard

    Hmm, levels of nesting isn't a big change to what you'd have to do. We'll make sure to include that in this.

  5. Bjarke Elias

    Thanks for the suggestions! We've added two new Attributes which will be there in the next patch:

                public bool HideInInlineEditorsAttribute;
                public bool DisableInInlineEditorsAttribute;

    You can access the current InlineEditor draw depth from here if you want to do something fancy.


    On a related note we've also deprecated the ShowForPrefabOnly and EnableForPrefabOnly attributes and added 8 new instead which gives you much more control:

                public bool HideInPrefabInstancesAttribute;
                public bool HideInPrefabAssetsAttribute;
                [HideInPrefabs] // Both prefab instances and prefab assets.
                public bool HideInPrefabsAttribute;
                [HideInNonPrefabs] // Regular gameobject instances
                public bool HideInNonPrefabsAttribute;
                public bool DisableInPrefabInstancesAttribute;
                public bool DisableInPrefabAssetsAttribute;
                [DisableInPrefabs] // Both prefab instances and prefab assets.
                public bool DisableInPrefabsAttribute;
                [DisableInNonPrefabs] // Regular gameobject instances
                public bool DisableInNonPrefabsAttribute;
  6. Log in to comment