We’d like your feedback on a new editor feature called “Presets”. Following is a video showcasing the feature:
This feature adds a “Preset” icon to component and importer inspectors. Clicking the icon pops open a menu allowing you to save and load Presets. Available Presets can be loaded directly into the selected object from the same menu.
Presets are assets containing saved property values from an Object, and can be loaded into other Objects of the same type. You can save a Preset from any existing Object in your project to use it at a later time.
Presets can also be set as default from the Preset inspector, from the new Preset Manager, or by selecting “Save As Default” from the Preset icon menu. Default presets are applied to new components and importers when they are created. This means you can effectively override Unity’s defaults with your own, on a per-importer and component basis.
Presets also come API enhancements that allow you to implement your own defaults system - we know that a single default is not enough, and the ability to set presets per-folder or by regular expression is useful.
Note that there is no persistent connection between a Preset and an Object to which it has been applied. Presets are “fire-and-forget”.
Please note that presets are not available in playmode or the runtime. They are an editor-only feature designed to accelerate your workflow, not an engine feature.
You can download an experimental build to try it yourself:
Cool!
It´s Component based preset, can be used with a custom script? like Enemy AI with variables, like speed, strong, damage power?
yes i know I can do it in my script by my own, but if it can be easier why not?!
cheers!
Yes, there is an API, so you can use them with custom scripts. However, note that Presets are an Editor-only feature, and are not available in the runtime or playmode.
edit: Playmode deserves some clarification: you can apply or create presets in playmode (usual restrictions apply), however preset defaults only work when creating objects in the Editor.
Woha! This looks really useful for defining imports superquickly! Does it support applying presets on multiple objects (e.g. textures)?
Too bad it is not working in playmode, that might have been a way to easily save changes temporarily.
Are you supporting the following?
Particle Systems
Animator Transitions
Animator Controllers
Scenes
Materials
I would also love to see a possibility to define new c# scripts or shader files with presets, but I guess that is a it much to ask for the moment.
My main suggestion is that having a global default importer per type is not enough. Rather, it’s much more common to have specific policies per folder. In this folder import everything as a sprite, in this one import them as compressed texture, in this one import them as LUTs (uncompressed, srgb off). It seems the preset system is almost perfect for that - but we would need a way to set a hierarchical default. Like the assembly defintions where through the folder structure to look for the most specific default preset.
EDIT: Just saw that this is something you mention in your main post, good to hear you are considering this. I do think the folder use case should be supported by default though
Few more questions:
Any thoughts on ‘partial’ presets? Aka - presets where only part of the properties of a component are applied. There’s lots of scenarios where it makes sense to only store stuff from a ‘group’ of properties of the object - or cases where it makes sense to have a few settings that are intended to be per instance. It’s like the Post Processing stack V2, it has a nice UI where you can toggle what properties to override.
Can we drag on presets to create a component or apply it? Similairly, any interaction with the add component button? It might make sense to be able to set an add component menu item for a specific preset.
Can we edit presets when selecting them in the inspector?
Lastly, just wanted to share a use case of our preset system (ori and the blind forest): We had some way to associate presets with say the main texture of the sprite renderer. Then we could apply all presets associated with that main texture to a few graphics components automatically, in batch. I don’t imagine this as a built in thing but I hope the API will be extensive enough to allow for these kinds of workflows.
Not sure I follow you, do you mean a single preset for different types of components ? Or like a “super preset” for a whole GameObject ?
Right now, Presets are per component. But I would like to know more about what you have in mind…
Exporting presets is kind of a must. I’ve got a plethora of pixel art projects that I have to write ever more complicated preprocessor scripts to stop them from being ruined by your default compression settings. A preset package would help a lot.
Even today at work I’m updating old projects - because your Unity Ads need updating! - and lots of things are set to “blurry and compressed”, which is awful for pixel art games.
Being able to say ‘always apply this preset for textures in this specific folder’ or ‘apply this preset for models that start with x’ is a must, good to see that is mentioned. Can we set assetbundle assignments from a preset?
Too bad it is editor only, it would have been cool to do something like this during runtime. e.g. lerp between two states of objects by dragging in two presets. Kinda like animations.
Hi guys, lot of feedback there
Here are some answers and a bit more details :
Yes, you can select all your textures in your project and apply the Preset once to all of them from the preset button.
Sorry for the confusion on this one, you can use the Preset while you are in the Editor, thus you can still create a new Preset from an object while in playmode or apply it from the UI
Just keeps in mind that because it is editor only, this kind of behavior will not work outside of the Editor.
Also, the default Preset for a newly added component will only be used from the Undo.AddComponent method or from the UI, because we don’t want the GameObject.AddComponent method to behave differently between your editor session and your final build.
Unfortunately we can’t support complex objects with the Preset system, that means that Scene and Animator Controllers will not be supported (they are a composition of object under the hood and this is not supported by the Preset).
Everything else will works, and we are also working with the animation team to integrate i nicely in the AnimatorTransition component in the future.
Preset are basically a copy of the serialization of your Object. c# scripts or shader are not serialized files, they are just plain text files, thus they can’t be supported by the Preset system to change their default values (however you can still create your own menu to generate a new text file with whatever you want inside !)
Yes, we are thinking about giving a built-in way to specify Preset per folder. However, you will be able to use the new OnPreprocessAsset() method inside the AssetPostProcessor class to apply whatever Preset you want to your AssetImporter on top of our default Preset Manager.
This way you can implement whatever crazy pattern to select your Preset based on the name, path or whatever you want.
Yes, we though about it and we also would like to implement it, however there is some design concerns on it thus it may come in a second iteration.
Didn’t though about that and I found it a good idea to add a component while dragging a Preset directly. However, we made a first try by adding the Preset files inside the AddComponent menu, but that become way too loaded with 20+ Presets of the same Component…
Not at the moment, but this is planned. At this time, you can still save a new preset over the old one to update its values (the Preset itself exposes a UpdateProperties methods than you can also use from your own scripts)
There is not automatically apply of a modified Preset. However you can still create your own script that keeps the links between your objects and the Preset and apply it to your objects whenever you want
It would be good to have the applicable presets show in a flat list instead of a submenu - too many clicks to apply it.
It would also be helpful to be able to apply presets defined for a class to any derived class or other class that shares the same base class. The common properties would be applied from the preset and ignores any derived class specific properties. I have this same problem when I copy a component and paste values. Paste Component Values only works if the target class is exactly the same class, even if they share the same base-class properties.
Yeah that sounds great, definitely need that for more complex logic. I do think having some way of defining presets per folder is really needed by default though. Its such a core use case that I feel like otherwise everyone will have to reimplement that system - and though that’s trivial - it means everyone might have subetly different ways of defining this. That’s hard to work with across projects, across asset store projects, etc.
Alright makes sense - just hope the serialized data format will allow that in the second iteration.
Oh yeah definitely wouldn’t want to add all presets to the add component menu. I would like it so that you can set a path for the add component menu for each preset. Maybe once the presets get an inspector there would just be a field for a user to set a path (eg “MyGraphicsSystem/Effects/WobblyWavePreset”)
Ah not exactly what I mean but… I will just have to try out the preview build and see whether the API will allow it Sounds good so far though!
This confuses me, if a preset is basically a copy of the meta file why isn’t it possible to copy the entire scene asset? I can imagine it being very useful to override the default “new scene”!
A Preset is actually a copy of the serialized values of one Object, which slightly differs from a meta file or what you can see in the plain text serialized file of the scene.
But I agree that being able to override the entire new scene default would be a nice feature too.
We though about that too, we will iterate a bit on such way to show the preset list and update here on what we can do to improve it !
That’s not supported at the moment but I like the idea, we will see what we can do to get closer to inheritance support.
It is a great idea, but it looks like a little bit messy. There should be a cloud based global preset manager so we can use these presets for other projects. We should be able to categorize them and also adding a description option for these presets would be great.
I’m making simple unity templates for my small projects. For example, I have a simple scene template for my realistic game projects. It has realistic post processing effects and light settings inside. So whenever I need to work on a HQ game I use this template for a quick start. I wish to see new build in solution for my template system.
This new preset feature won’t help me a lot because I will be still using “copy component and paste component values” technique ))
This preset feature is a cool idea and I’m looking forward to see a more advanced version of it.