‎ ‎
On the Asset Store
BlackBox
BlackBox
  • Intro
  • Changelog
  • Troubleshooting
  • Main features
    • Locking Prefabs
      • Temp Unlock
      • Extra locking options
    • Reveal
      • Properties
        • UnityEvents as buttons
      • Entire components
      • Object references
      • Methods
      • Reveal lists
    • Disable Apply
  • Integrations
    • Odin Inspector
  • Other
    • Selection type
    • Project Settings
Powered by GitBook
On this page
  • How to enable Odin integration
  • Revealing a property with Odin
  • Caveats
  1. Integrations

Odin Inspector

Last updated 5 months ago

BlackBox integrates with , and can display most of its attributes correctly for properties that in the BlackBox component.

Please note that when Odin is installed in your project, you will lose the ability to in all Inspectors drawn by Odin. You can still reveal properties .

How to enable Odin integration

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:

Revealing a property with Odin

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]:

[MinMaxSlider("DynamicRange", true)]
public Vector2 DynamicMinMax = new Vector2(25, 50);
public Vector2 DynamicRange = new Vector2(0, 50);

By default, once revealed, this property would just show as a Vector2:

To ensure it displays correctly, you need to add the [RevealWithOdin] attribute:

[MinMaxSlider("DynamicRange", true), RevealWithOdin]
public Vector2 DynamicMinMax = new Vector2(25, 50);
public Vector2 DynamicRange = new Vector2(0, 50);

With it, it will automatically display as expected:

Caveats

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.

  • 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.

You won't be able to reveal Odin properties by and choosing "Reveal with Blackbox". You need to find the property on the BlackBox component, by clicking the "Show Available Properties" button (as described ).

Even if you for a particular prefab, the user will always be able to Apply on Odin-decorated properties. This is unfortunately something we cannot override.

disable Apply
Odin Inspector
have been revealed
right-clicking the original property
here
right-click > "Reveal on BlackBox"
from the BlackBox component