Odin Inspector
Last updated
Last updated
BlackBox integrates with Odin Inspector, and can display most of its attributes correctly for properties that have been revealed in the BlackBox component.
Please note that when Odin is installed in your project, you will lose the ability to right-click > "Reveal on BlackBox" in all Inspectors drawn by Odin. You can still reveal properties from the BlackBox component.
First, obviously, you need to have Odin Inspector in your project. This should automatically add some scripting define symbols to your project. If you're in doubt, go to Project Settings > Player > Other settings > Scripting Define Symbols, and ensure that the symbol ODIN_INSPECTOR
is there:
By default, if you reveal a property that uses one of Odin's attributes, it will just display with its original, Unity-official property drawer. Let's assume for instance a property decorated with [RangeSlider]
:
By default, once revealed, this property would just show as a Vector2:
To ensure it displays correctly, you need to add the [RevealWithOdin]
attribute:
With it, it will automatically display as expected:
When revealing a property that is decorated with an Odin attribute, there are some things to keep in mind:
Not all attributes are supported. Especially the ones heavily modifying the layout (like [Box]
or [FoldoutGroup]
) will not work.
You won't be able to reveal Odin properties by right-clicking the original property and choosing "Reveal with Blackbox". You need to find the property on the BlackBox component, by clicking the "Show Available Properties" button (as described here).
Even if you disable Apply for a particular prefab, the user will always be able to Apply on Odin-decorated properties. This is unfortunately something we cannot override.
Odin-decorated properties don't play well with the Prefab system, and don't support nested Prefabs. This is a general Odin limitation, and something we don't have control on.
If a property is misbehaving or doesn't look correct, just remove the [RevealWithOdin]
from it to draw it again using its default Unity-provided Property Drawer.