Hey all! Blackboxing for Prefabs (or “BlackBox” for short) has been released!
BlackBox is a simple framework to enable a workflow that is often referred to as “turning a Prefab into a black box”, or “encapsulating”, “collapsing” or “locking” it (there is no official name). A locked Prefab will appear to the user as if it was a single GameObject, with no additional components. This prevents unwanted overrides and simplifies workflows in a team, especially in the area of level design.
Additionally, the BlackBox component allows to reveal deeply-nested properties of any child object on the component’s Inspector. This can be done even if the Prefab is not locked!
This is pretty much it! It’s a simple asset, but I’m sure it will help you loads in multiple different workflows. Try it out, and let me know what you think! I will keep refining it based on your suggestions.
Of course a review would be greatly appreciated!
PS: It’s still on 30% launch discount for now, but not for much longer.
The other day, a new update for BlackBox went out. And it is HUGE!
Version 1.3.0 allows to Disable Apply for overrides on specific Prefabs. This means that you can manipulate a Prefab and have overrides on it, Revert them, but never Apply. This brings maximum safety to the Prefab workflow.
So to celebrate, I made a new and snappy video showcasing the flow and the advantages.
Added support for Odin Inspector! If a revealed property has an Odin Inspector attribute, you can ensure it draws correctly inside BlackBox by simply adding a [RevealWithOdin] attribute to it.
This release adds the ability to reveal even more on the BlackBox component, so you can be even more productive, while still enjoying safe Prefab workflows. Better error detection. Plus, lots of tweaks to the UI make it all clearer, and more consistent.
Changelist:
Added the ability to reveal public methods from components as buttons, alongside Revealed properties.
A new mini-label in the Prefab Mode inspector makes it easy to identify what is the component that a certain property or method comes from, just by hovering over it.
Added the ability to reveal UnityEvents as buttons, by decorating them with the attribute [RevealEventAsButton].
MUCH better error handling. Now the BlackBox will keep working even in case of missing properties and methods. In addition it will display their name before you remove them, so you can reconnect them again.
Each BlackBox component can now expose one or more lists of revealed items (up to 10), instead of only one list as before. Lists can be used to create different sets of revealed properties for different personas, like for instance, one for each sub-team in the company (designers, programmers, etc) or for each person on the team.
Each list can have a name, which will be displayed on buttons that allow to switch between lists while working.
A new button has been added to the component in Prefab Mode, to enter list editing mode. This mode allows to rename revealed lists and change their properties.
Lists can be made invisible, so the button representing it won’t show.
For each list, you can specify whether or not to group the revealed items by the GameObject they belong to. Lists that don’t group by GameObject won’t show the GameObject headers, so all revealed items will be shown one after the other with no space in between.
While editing lists, the revealed items of each list can now be easily reordered, just by using drag and drop.
Right-clicking on the property of a child object now allows to choose which list to reveal the property in.
Right-clicking on a component now allows to reveal that component on the first list.
Improved creation of selection mesh for Prefabs that contain meshes with sub-meshes.
Yesterday I published a new video as BlackBox 1.7.0 went live. This is a bit longer than usual, but it should give you a good sense of all the things BlackBox can do now!
PS: The asset is still 50% on discount – as of this post.
When you use it from the start (for new prefabs) it’s all good. But if you want to start using it in the late development, when you already have a lot of prefabs with overrides all over the place, then it could be improved.
For example, say I have one prefab in the scene with some overrides. If I attach a BlackBox to the original, now all my overrides still work but I don’t have a clue which ones I did on that particular instance, so I can revel them. I need to open the original, uncheck the Disable Apply, go back to the scene and see all the properties, go back to prefab and reveal them in BlackBox. And if I forgot some of them, repeat the process. And multiply all of that with number of instances with different overrides.
My suggestion would be that as soon as you add BlackBox, you search the whole project and find all the instances with all the potential overrides and offer to automatically reveal them for me. If there are no overrides anywhere you simply skip that popup.
Maybe there is already something that works like that but I couldn’t find it?
And while I tried to find a way around this issue, at start I didn’t know I have to uncheck “Disable Apply” to see the used overrides, I instinctively tried to disable the whole BlackBox script:
and found that it works the same even if disabled, so maybe that could be fixed too?
This is a good suggestion. And a good point regarding adding the component to an already heavily-overridden Prefab. I got other people suggesting this auto-detect of overrides, I think it’s next on my todo list.
However, there are design challenges. Overrides are not in the Prefab, but on the Prefab. So baking a list that automatically shows all overridden properties is impossible, because each Prefab instance has different overrides (and they can change in time, as you Revert and Apply).
So one way to do this is perhaps to create a special list that is dynamic: every time you select the Prefab, it scans that particular instance and collects all overrides as Revealed properties.
How does that sound?
In reality, you should never be able to disable or remove the component in the scene. That’s why in the scene you should see a semi-transparent bar on it, that impedes you from clicking the checkbox.
I assume you disabled it in Prefab Mode?
So you’d expect that if you disable the component, it should just unlock the Prefab?
It sounds good. I just don’t know how “heavy” that dynamic list generation may be, so instead of automatic scan every time I select a prefab, I’d be more than happy to have a dedicated button there - something like Scan for Overrides and then offer me to Reveal or just ignore it if I want
Yes I tried disabling it in the Prefab mode, not in the Scene. And yes, I instinctively thought that would do the same as if I fully removed the BlackBox component from the prefab. Only difference would be that all the settings/reveals/everything would be saved for later when I decide to enable the BlackBox again.
I’ve actually given it a shot yesterday. In my exploration it’s not as much as to how heavy it is to get the list, it’s more that the list might end up being too long, unnecessarily. It’s much more confusing than the Overrides dropdown, and it would look something like this:
Basically tons of properties that you might not be interested in, often with the same names.
This could be an option. It would still produce the monster list like that, but hey, you asked for it!
The challenge with this option is what do I do if: you decide to remove a few of those revealed variables, then you then add overrides at a later stage, then press the button again. It can get hairy very quickly.
Need to think!
It makes sense. I will improve the user experience here.
First, that list should omit the variables that are already revealed
Next, it could be separated in a few logical groups/dropdowns so it doesn’t show as a monster on a first click Maybe it would be enough to separate by components and also nested by parent/child relation
And finally, maybe the checkmarks on the left on each group/variable so besides Reveal All button on the bottom you can add Reveal Checked
I’ll think about it. I feel like this workflow goes against what the asset is trying to do though: creating clarity. By doing this, the tool would be asking the user not just to show what they want to see, but to hide what they don’t want to see. Feels a bit reversed.
Plus, the objective of displaying what’s overridden is already covered by the Overrides dropdown, which gives a lot of clarity with its grouping per object, per component, and with all the icons. Basically I’d be remaking the same thing… but a bit shittier
I don’t think I can (but I want to investigate it, for other reasons).
But I want to say: for me, while it makes sense to Reveal properties to be overridden, it makes less sense to Reveal properties that have been overridden.
In the first case, the Prefab creator is basically saying to the rest of the team: “Here, these are the properties that you can touch. Everything else is locked/invisible.”
In the second case, you have a specific instance of a Prefab in the scene that has some property overridden. Is it correct? Or was it just a test? We don’t know.
But now the user of the Prefab (not the creator!) can expose that property for everyone to override, again. It’s almost like having an invitation to create more chaos.
Thanks for the understanding. It’s great to chat about these things anyways, even writing down my thoughts makes my thinking clearer to me (sometimes highlighting contradictions)
Rubber ducking, right?
But yes, generally speaking I envisioned BlackBox out of my experience with the Gigaya project, where we were (at some point) 16 people. In fact I have one more cool thing to add to this package for medium/big teams, let’s see how long it takes me to make it
(also, a small secret: owning BlackBox gives you a big discount for the big bundle with all my assets All Editor Tools bundle. And this happens even if you get BlackBox as part of this sale)