Search Unity

Presets Feature

Discussion in 'Editor Workflows' started by markvi, Aug 29, 2017.

  1. markvi

    markvi

    Joined:
    Oct 31, 2016
    Posts:
    118
    Hi all,

    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:

    Mac Version: https://oc.unity3d.com/index.php/s/erMvBmWuLdhVAT8
    Windows Version: https://oc.unity3d.com/index.php/s/CurjcuSZP2VBGzM

    Please let us know what you think!
     
    Last edited: Aug 29, 2017
    dyupa, AlanMattano, allenwp and 12 others like this.
  2. d-3

    d-3

    Joined:
    Oct 18, 2009
    Posts:
    213
    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!
     
  3. owlchemylabs

    owlchemylabs

    Joined:
    Jun 4, 2016
    Posts:
    1
    This is incredible and we would use this all the time. 1000% yes.
     
  4. AFrisby

    AFrisby

    Joined:
    Apr 14, 2010
    Posts:
    223
    Oh thankyou!
     
  5. markvi

    markvi

    Joined:
    Oct 31, 2016
    Posts:
    118
    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.
     
    Last edited: Aug 30, 2017
    d-3 likes this.
  6. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    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.
     
    Last edited: Aug 30, 2017
  7. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Looks great!

    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.

    Thanks!
     
    Last edited: Aug 30, 2017
    Noisecrime and zyzyx like this.
  8. ventrap

    ventrap

    Unity Technologies

    Joined:
    May 30, 2017
    Posts:
    10
    Hello,

    Can you tell us a bit more about how you would use it ? Thanks !
     
  9. ventrap

    ventrap

    Unity Technologies

    Joined:
    May 30, 2017
    Posts:
    10
    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...
     
  10. st33d

    st33d

    Joined:
    Jan 22, 2014
    Posts:
    28
    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.
     
  11. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    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.
     
    laurentlavigne likes this.
  12. Flashynurav

    Flashynurav

    Joined:
    Nov 27, 2016
    Posts:
    1
    Do you have any idea of how the scripting API would be? Simple or complex?
     
  13. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    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 :)

    Hope that helps !
     
    chelnok, d-3 and Noisecrime like this.
  14. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    390
    Looks super useful!

    1. It would be good to have the applicable presets show in a flat list instead of a submenu - too many clicks to apply it.
    2. 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.
     
  15. Johannski

    Johannski

    Joined:
    Jan 25, 2014
    Posts:
    826
    Thanks for the indepth answers!
    Ah cool, that's good news!

    Hm, makes sense. Looking forward to overriding the default AnimatorTransition!
     
  16. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Thanks for the reply!

    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!
     
  17. TalhaDX

    TalhaDX

    Joined:
    Feb 2, 2013
    Posts:
    94
    Very good addition to the editor feature list. good work
     
  18. TimHeijden

    TimHeijden

    Joined:
    Mar 5, 2015
    Posts:
    34
    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"!

    Still looks very cool regardless!
     
  19. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    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.

    1. 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 !
    2. 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.
     
  20. seckincengiz

    seckincengiz

    Joined:
    Jan 7, 2014
    Posts:
    2
    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.
     
  21. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    We are not going to implement a cloud based feature for the Presets, but Presets are assets so you can create a package with the ones you need to import in another project.

    Using some of them as default (like your light settings for example) will allow you to have these settings directly applied to you Light component when you add it to a gameobject in the Editor.

    Also a Preset would allow you to copy any Component and save that copy as an Asset. You can then paste those values on another Component at any time, which means you don't need to search for your reference object in the scene or wherever you saved it, because the preset UI always now every existing presets in your project.

    Having a description in the Preset file is not a bad idea actually, we will dig into that, showing it as a popup when you over a Preset in the selector may looks nice !
     
    TJHeuvel-net likes this.
  22. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Please dont cloud this.
     
    Baste and Enrico-Monese like this.
  23. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,510
    At last, the editor receives some love with features useful for daily use. Thank you so much!

    I love the presets being stored as regular assets in the project. I may easily use a git submodule for sharing the presets among different projects.

    +1 to the drag&drop workflow to create a component using the preset's values. Also, it would be super useful to drag&drop a preset directly onto an existing component to apply its values.
     
  24. d-3

    d-3

    Joined:
    Oct 18, 2009
    Posts:
    213
    Thanks for the clarification!! :)
     
  25. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Briefly checked out the API, and some feedback:

    -Need PresetManager.GetAllPresetsForObject and PresetManager.GetAllPresetsForObjectType, and need a PresetManager.GetDefaultForObjectType(string typeName). Only having GetDefaultForObject is not enough to built more custom tools on top off

    -Why is PresetManager an Object? Doesn't really matter but clutters intellisense.

    -What is Preset.IsValid() ? How can a preset be in a non valid state?

    -Would be nice to have an Apply() API for a single property modification. Can be done atm but takes a few lines

    Then there's also another problem. It seems presets are applied _after_ OnEnable and such, unlike defaults set by a script. This means that any 'configuration' presets that setup default references and parameters for resources created and such can't be used without hacks to only init a frame later etc. [ImageEffectAllowedInSceneView] has the same problem for post effect components and it has been a huge pain to deal with - unity has acknowledged that bug. I really hope the presets can forego this mistake from the start.
     
  26. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    lol I just saw the video I was like damn that is exactly what I wanted last year when I made a feature request to wanzyee the copy clipboard guy, as he seemed to have closet codebase to being able to implement such functionality....

    https://forum.unity3d.com/threads/f...ultiple-components.377921/page-2#post-2887933

    2017.3 can't come soon enough I been wanting component presets for ages, it does work for all components right?

    "You can download an experimental build to try it yourself:"

    I tend not to bother with individual experimental builds.. please get it into 2017.3 though :)
     
  27. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    I understand the need for type relative presets and not Object relative, but doing it this way allow you to preset even internal types (and we also have some mismatches between native c++ types and the C# exposed, some C++ objects doesn't even exist in C# other than being a UnityEngine.Object...)
    However, we will keep that in mind and see if we can expose some better API to manage defaults.

    It'll be a static class in the future, we are still working on its implementation and this part may change a lot.

    A Preset can be invalid if you delete the class it was referencing.
    Let say you create a monobehaviour, put it on a gameobject, create a Preset from it and then delete the script file. The Preset is now in an invalid state because it holds values for a script that is not reachable anymore.


    Do you mean like preset.Apply(target, "my.property.path") ? that would only apply this particular property to the target ?
    Gonna think about that, it may be a good idea to have it before we are able to support partial presets.

    We will dig into that problem and see what we can do to support this correctly.

    All components, custom and native ones !
     
  28. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591
    Great, thanks for the answers!

    >I understand the need for type relative presets and not Object relative, but doing it this way allow you to preset even internal types

    Mmh I see - makes sense the GetTargetTypeName just returns a string then. However couldn't the reverse be done too? So there would be an API GetAllPresetsForObjectTypeName(string typeName) etc.

    >Do you mean like preset.Apply(target, "my.property.path") ? that would only apply this particular property to the target ?

    Sort of - right now the preset has a PropertyModification[] PropertyModifications { get; }. What I would like to see is to basically do:

    myPreset.PropertyModifications[0].Apply();

    Then you could do something akin to partial presets like:
    Code (CSharp):
    1. foreach(var mod in preset.PropertyModifications){
    2.      if (ShouldApply(mod)){
    3.           mod.Apply();
    4.      }
    5. }
    Later on it'd be great if the presets had some bool[] or whatever that users can set in the GUI to enable / disable some property modification.
     
  29. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    Nice, when does 2017.3 come out :)

    Looking at the video.. I do think that dropdown menu layout should just show presets directly, instead of buried in an extra 'Apply Preset' menu, maybe if there preset results grow past a certain number they can go in a sub menu or have sub menus for different sorting of presets. Also sorted by date/time of preset creation or last used? And anything like hotkeys that can be used while a certain component is actively selected to directly do cycling/ back/forth toggle between the active presets especially if presets are sorted by last used, that would be super helpful.

    ---Apply Preset--- (Doesn't show unless there is a preset to select.)
    <presets listed here> (date/time in smaller font grey)
    ----------------------
    Save Preset
    Save Default Preset

    On the asset creation for presets.. would it be possible to further manage what particular parts in those presets is active.. like being able to enable/disable certain bits in them so they don't override and change an existing setting. This way if you take a preset of camera settings, but only really care about a particular preset saving the FOV, and not applying the snapshot of other values if selected.

    The PresetManager could probably have more options for this stuff :)
    Many ways to go with improving the preset feature anyway.


    That's kind of a shame, maybe in the future some other ways of making parts of the preset stuff work in playmode would be very useful . Infact essential because lets face it, I'd imagine alot of game designers make most the tweaks to components while in playmode, presets should help with assisting in that area of iterating and comparing changes and saving those changes more quicker for better workflow :) . (Atleast the parts that can be made to safely work in playmode)
     
  30. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    We will also expose a GetDefaultForPreset() that get a preset attribute instead of an Object, and will return the current default for the same preset type. The string version could be a lot misleading at first - as an example, ModelImporter is abstract in reality and the instance is of type FBXImporter, which no one can figure out because this type is not exposed in C#... - but we will see if we can do it and expose it anyway for our tricky users.

    I would rather expose Preset.ApplyTo(Object target, params string[] properties), this way you would be able to do :
    Code (CSharp):
    1. var list = new List<string>();
    2. foreach(var mod in preset.PropertyModification)
    3. {
    4.     if(ShouldApply(mod))
    5.     {
    6.         list.Add(mod.propertyPath);
    7.     }
    8. }
    9. preset.ApplyTo(object, list.ToArray());
    It is a few more lines, but it makes us one step closer to support partial presets ;)

    We are reworking a lot this UI. We actually though about using a modal window instead of the dropdown (kind of the ObjectPicker or ColorPicker). We made some tests and having a search bar + being able to switch between preset without having to reopen the UI each time looks very nice !

    The preset UI will work in playmode, it is an editor only feature which means that it will not exist at runtime, but during playmode, you can still apply and create preset from your object.
     
  31. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    That modal window sounds good to have aswel, especially if it will have more view layout control/sorting etc stuff over the presets for a particular component to go through without needing to goto the drop menu everytime.. just don't remove the drop menu either :)

    ok that's better and less confusing..

    Yes :)
     
  32. pvloon

    pvloon

    Joined:
    Oct 5, 2011
    Posts:
    591

    Mmh I just think it's a little strange API. Say you would write:

    Code (CSharp):
    1. preset.ApplyTo(object, "random path that is not in the preset");
    This is not valid of course. Unity would have to validate and lookup each path in there to make sure the preset actually has it etc. An API that needs such intense verification feels off.

    Maybe if you want to keep the ApplyTo style, ApplyTo(Object o, bool[] doApply); would feel a little cleaner. Either way ApplyTo looks, having PropertyModification.Apply would still be nice to have. Say you want to reapply a particular field for every object. Then you could write:

    Code (CSharp):
    1. var prop = preset.PropertyModifications[0]; //Find the color property or whatever.
    2.  
    3. foreach(var obj in allObjects){
    4.     prop.Apply(obj);
    5. }
     
  33. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    The Color type is not a property. It is a struct that contains 4 properties (a, r, g, b).
    In order to apply the Color of an object from the PropertyModifications, you will have to find each one of those property (m_Color.a, m_Color.r ....) and apply them one by one.
    The Apply method itself is very resources consuming because it have to go through the memory data of you object and find the correct place to update the value. Having a list of properties to apply allow us to do this walk-through only once, whichever was the number of properties you want to apply.
    Also, we can filter which properties you provide and include automatically every child of those properties (and ignore every non-matching properties).
    Starting dealing with arrays add even more trouble, for example a Color[1] would be :
    m_Array.size
    m_Array.data[0].a
    m_Array.data[0].r
    m_Array.data[0].g
    m_Array.data[0].b
    In this case, you would use preset.ApplyTo(object, "m_Array") and we will take care of every values for you.

    I hope that makes more sense to you with these details :)
     
  34. markvi

    markvi

    Joined:
    Oct 31, 2016
    Posts:
    118
    I hate to be the bearer of bad news, but Presets won't land until 2018.1. The good news is that we're taking the extra time to address the issues raised here and elsewhere.
     
  35. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,533
    damnit! Where is my hibernation capsule :D
     
    xCyborg likes this.
  36. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    What happened? On the bright side, 2018 is just 3 months ahead :)
     
  37. Rollboy0

    Rollboy0

    Joined:
    Jun 12, 2013
    Posts:
    4
    I see lots of advantages of using presets
    I thought this could help a lot with current prefab issues

    lets say we have 10 enemies, with same textures and colliders and they only differ in their behaviors and stats
    why should I create 10 prefabs and make 10 times the same change...?

    we could call at runtime GameObject.Instantiate(prefab, preset, transformProps)

    Nice to see we have this feature for the near future :)
     
  38. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,619
    According to the first post, presets is an editor feature only and not available at runtime.
     
  39. Rollboy0

    Rollboy0

    Joined:
    Jun 12, 2013
    Posts:
    4
    thanks for your answer Peter77 :p, even though I read full thread posts
    was just putting some light on a possibility
    In my opinion it could "leverage" some stress people has on prefabs
    not my case.
     
  40. Klausast

    Klausast

    Joined:
    Nov 27, 2014
    Posts:
    7
    Is there any way to save presets as scriptable objects to use them in runtime ?
     
  41. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Unfortunately not.
    You can save a Preset in your project using the .preset extension, but the class itself is inside UnityEditor and can't be used at runtime.
    The Preset.ApplyTo method relies on a bunch of serialization methods like SerializedObject.CopyFromSerializedProperty that we can't provide at runtime for both performances and implementation reasons.
     
  42. f1ac

    f1ac

    Joined:
    May 23, 2016
    Posts:
    65
    It looks like it is not possible to apply presets to project settings (player, graphics, quality etc.) from code. Would be a great time saver when one needs to quickly setup a new project. I mean something like this:

    Preset playerSettings = AssetDatabase.LoadAssetAtPath<Preset>("Assets/Presets/Settings_Player.preset");
    playerSettings.ApplyTo(PlayerSettings./*no object reference to apply to*/)
     
    Brad-Newman and Arkade like this.
  43. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    I've got a question about using Presets for importers.

    One of our current main pain points is that it's impossible to automatically import fbx files as humanoid through asset importers, as a lot of the things Unity does when you set an fbx file to humanoid (automatic mapping, fixing pose, etc.) can't be done from scripts.
    This means that every model has to be imported (takes a minute or two per model), and then we have to go into the inspector to change a setting and do the same wait again.

    Would it be possible for me to create a Preset for the Model/FBX importer that has the model set as Humanoid? And would that import the file correctly?
     
  44. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Hi!
    Unfortunately, Unity does not expose direct access to those managers.
    However, you can find a way to trick it using https://docs.unity3d.com/ScriptReference/EditorApplication.ExecuteMenuItem.html to select the manager and apply the Preset to Selection.activeObject ...
     
    Arkade likes this.
  45. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Hey Baste!
    We are aware of some limitations regarding the ModelImporter which are mostly due to the UI and working hard to refactor that so it is easier to interact with it from code and Presets. However, it will not make it to 2018.1 but stay tuned for fixes and improvements in future versions.
     
  46. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Hiya,
    (Hope this is the right place for this) I just grabbed the latest Unity 2018 and had a quick play with the presets feature.
    The first thing I tried it on was animation clips, because I have 50 or so of them as seperate @animationName .fbx files. I thought it would be really handy to keep the import settings that same easily.
    In that situation though it did't really work that well because it also adjusts the settings in the "animation" section which you want to be individual to each clip (Stuff like animation ranges, ect).
    Is there a way presets can handle that situation?
    Thanks!
    Pete
     
  47. bastien_humeau

    bastien_humeau

    Unity Technologies

    Joined:
    Jun 14, 2017
    Posts:
    191
    Hi Pete!
    This problem is due to the fact we cannot prevent the Preset to apply all of the properties of the importer to your target, which is annoying when touching the ModelImporter and the animation clip list.
    This is a known issue and we are working actively on a solution. Unfortunately, this requires both new improvements in the Preset system and lots of fixes/refactors in the ModelImporter UI, which forces us to delay this fix until 2018.3 (2018.2 being now in beta prevent us from bringing such refactor in it).

    The best usage at the moment would be to use the FBXImporter preset as default with no animation and leave the importer system setup these during the first import. Using such Preset on an already imported asset will lead to the loss of some asset specific data.
     
  48. petey

    petey

    Joined:
    May 20, 2009
    Posts:
    1,824
    Thanks @bastien_humeau, yeah I could see that that modelImporter could be problematic. Good luck getting it all sorted, I'l keep an eye out in future releases.
     
  49. dadude123

    dadude123

    Joined:
    Feb 26, 2014
    Posts:
    789
    Does that mean that eventually we'll be able to remove specific properties from presets? So they'll not be modified?
    That would be great.
     
  50. MultivariousDev01

    MultivariousDev01

    Joined:
    May 22, 2014
    Posts:
    28
    Just discovered this feature, it's pretty handy!

    Slightly annoying that, for things like Buttons, the preset will mess up the Target Graphic field...

    It's not a big deal to reassign it, especially since it's usually in the same GameObject, but still, it would be nice to have a bit of partiality to the whole thing, even if you can only manage it from the preset's own inspector.

    Setting an instanced field to "<None>" is better than having it confusingly set to a different GameObject's instance, because it breaks it and forces you to fix it immediately, but it would be nice if the Preset had a custom-inspector option to set it to "<DoNotChange>". Obviously that option doesn't make sense from a component instance's perspective, so only the Preset object itself would have access to it.

    Otherwise, great little time-saver!