Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

uPrefabs - Nested Prefabs [Released - v1.8f5]

Discussion in 'Assets and Asset Store' started by darkForester, Sep 23, 2016.

  1. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80


    uPrefabs is the nested prefab solution for Unity.

    Asset Store Link - https://www.assetstore.unity3d.com/en/#!/content/72007

    We wanted to create a solution to the common need to make changes to a prefab, that is contained within many other prefabs; while keeping true to Unity's style.

    Revert Object Demonstration


    Revert Components Demonstration




    Instance Reverting & Applying

    Our solution is to add new contextual menus to the revert and apply buttons. You can now revert the object (the standard way) or revert individual components.

    Now you can apply and revert not just a single prefab, but the individual components and objects within themselves.




    The hierarchy will show you the name of the referenced prefab, and its current state. It will provide granular information on what was modified, added or is missing.

    Project Reverting
    Not only can you revert on the instance itself, but you can now revert through-out the entire project via the same revert tools menu located on the prefab asset itself. No more hunting down and replacing by hand.

    Extensible
    With our ComponentProcessors, you can write handlers for what values get reverted. The default behaviour is to overwrite all the instanced values, but one may want to keep certain values intact; IE: Text value on the Text component.

    Support
    Please feel free to message on this forum post, or via direct messaging. For in-depth support, direct message me and we can set up email correspondence or video chatting.

    In Development And Stable
    We will continuously update and add new features as requested by our users via the issue tracker.

    Links
    Wiki & Documentation - https://bitbucket.org/antiherostudios/uprefabs/wiki/Home
    Issue Tracker - https://bitbucket.org/antiherostudios/uprefabs/issues?status=new&status=open
     
    Last edited: Apr 13, 2017
    boysenberry likes this.
  2. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    v1.2f1 now released
     
  3. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    What can you do with uPrefabs?
    • UI element templates (shared buttons, text, etc.)
    • Revert nested prefabs to update models, materials, and other components
    • Simplify your project, no-longer a need to track down which prefab instances were updated
    • Change once, revert everywhere!
     
  4. Mangas

    Mangas

    Joined:
    Jan 16, 2013
    Posts:
    17
    I have a few problems with the asset right now, when the asset is on the project I can't instantiate a prefab throwing it directly to the Scene window, and the prefabs doesn't show any miniature images, so it's difficult to differentiate between prefabs at first glance. Do yo know what might be causing these?

    I'm using Untiy 5.4.0f3.
     
  5. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    1. Scene Dragging Issue - This has been resolved in the most recent 1.2f2 release.
    2. No GameObject previews - This is coming in a 1.2f3 release

    Thanks,
     
  6. Froghuto

    Froghuto

    Joined:
    Oct 4, 2012
    Posts:
    61
    We just bought this plugin and I have to say it's excellent! Thank you VERY much for this, finally a working nested prefabs solution.
    I found a couple of issues:
    • the Update() method in uPrefabChild is called in the game, and even though it only checks Application.isPlaying when having really big and a lot of prefabs it still costs a bit of performance. It might make sense to enclose the Update() method in a #if UNITY_EDITOR?
    • it seems that when I change the layer of a prefab that is a child prefab and revert it in the project nested instances of that prefab don't get the changed layer in the scene.
    • The static checkbox in the gameobject inspector just sets the static flag on the gameobject, but the original gameobject inspector allows to set the different static flags (Lightmap, Batching, Navigation, etc)
     
    Last edited: Oct 17, 2016
  7. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @Froghuto Thank you for the kind words and feedback! I just submitted 1.4f2 to the asset store for review. This upcoming version has that fixed for the Update method.

    If you have a moment and would like to submit the other two issues to our Issue Tracker at https://bitbucket.org/antiherostudios/uprefabs/issues?status=new&status=open that would be very helpful!

    The upcoming version refactored how children are stored which may cause you to re-setup the uprefabs on them; but for the most part should be pretty easy.

    Thanks again!
     
  8. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    v1.5f3 released

    This version brings major bug fixes and stability. The performance issues are gone and full reference issues have been resolved.

    Thanks!
     
  9. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    v1.5f4 released

    This version brings many fixes and enhancements that return the default "static-flags" toggle to the inspector.

    Thanks!
     
  10. BAIZOR

    BAIZOR

    Joined:
    Jul 4, 2013
    Posts:
    89
    It looks cool, but what about inheritance prefabs?
    Currently we are using Prefab Evolution, it has perfect functional stack, but it doesn't work perfect, a lot of crashes when prefabs have deep tries of both nesting and inheritance.
    It will be perfect if you release migration functional from Prefab Evolution.
     
  11. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @BAIZOR inheritance within uPrefabs is currently not implemented, but could be simply a matter of perspective. Take the following UI setup:

    Window (Prefab)
    - Background Image
    - Vertical Layout

    You could then create several other prefabs:

    Login Panel (Prefab)
    - Window (Instance of the Window prefab)
    -- Vertical Layout
    --- Instance child (etc)

    Register Panel (Prefab)
    - Window (Instance of the Window prefab)

    In uPrefabs you can revert based on components individually. So you could modify the children Windows within each of the different panel prefabs and retain those changes if you wish while reverting other changes. However, you could also revert the entire Window object, which would reset all values and sub-children back to the Window's prefab state.

    Inheritance may not be added to uPrefabs for the following reason:

    If an instance of a prefab points to the prefab asset, it therefore inherits from that asset. To say a prefab instance inherits from an asset, yet is an instance of another, would only add confusion and thus become un-Unity like.

    Thanks for the question!
     
  12. BAIZOR

    BAIZOR

    Joined:
    Jul 4, 2013
    Posts:
    89
    @darkForester thanks for the answer. In theory it may work.
    Anyway I have couple of questions:

    1.
    If I create nested prefab from Login Panel for example than change Background Image (object from Window prefab) in Login Panel prefab. Than change Background Image color property in Window Prefab and press apply on Window prefab. Will it work?

    Window (Prefab)
    - Background Image
    - Vertical Layout

    Login Panel (Prefab)
    - Window (Instance of the Window prefab)
    -- Vertical Layout
    --- Instance child (etc)

    Login 2 Panel (Prefab)
    - Login Panel (Instance of the Login Panel)
    -- Window (Instance of the Window prefab)
    --- Background Image (change image source)

    and the same question but with one layer deeper:

    Game Object (Prefab)
    - Login 2 Panel (Instance of the Login 2 Panel)
    -- some UI sizes changed
    - Login Panel (Instance of the Login Panel)
    -- some UI sizes changed
    - etc nested prefabs or objects

    2.
    Do you plan implement inheritance (without creating dummy parent object)?

    3.
    Is it possible create migration script, from Prefab Evolution to uPrefab?

    Thanks!
     
  13. BAIZOR

    BAIZOR

    Joined:
    Jul 4, 2013
    Posts:
    89
    And one more cause:

    in the same prefabs structure, remove Background Image in Window prefab and press apply (it means breaking the prefab).

    What will happen?
     
  14. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @BAIZOR here are the answers to your great questions!

    1. Yes, this is base nested-prefab behaviour. There is a two-step process to this. You would first apply your changes to the background image inside of the Window prefab.

    Then you could do a number of things.

    A. You could select the background image in the project and then go Revert->Object which would find all instances of that object and revert them (any children included).

    B. The best option, is to go Revert->Image Component. This would go through all of your prefabs and revert that component on any instance of the Window/Background Image.

    C. You could even Revert->Object the entire Window, but you would lose children.

    2. If there is a large demand, and it would fit within Unity's mantra of "It should just work" then maybe.

    3. I could take a look into what that would take. I am not sure how their system works under the covers, but it may be possible.

    4. Nothing will happen in any prefab unless you want it to. If you remove the background image and apply. It will not be removed from other prefabs unless you go Revert->Object from the asset itself. This will then cause the others to update as appropriate.

    Thanks!
     
  15. Barliesque

    Barliesque

    Joined:
    Jan 12, 2014
    Posts:
    78
    I've been seeing the following error messages popping up in v1.6f4...
    Code (CSharp):
    1. NullReferenceException: Object reference not set to an instance of an object
    2. AntiheroStudios.uPrefabs.Editor.uPrefabUtility.DoObjectsMatch (System.Type type, System.Object val1, System.Object val2) (at Assets/AntiheroStudios/uPrefabs/Editor/uPrefabUtility.cs:290)
    I've fixed it simply by inserting the following:

    Code (CSharp):
    1. if (val1A == null && val2A == null)
    2. {
    3.     return true;
    4. }
    I presume this should be returning true, but let me know if I'm mistaken.
     
  16. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @Barliesque Thanks for reporting this. We have an issue tracker: https://bitbucket.org/antiherostudios/uprefabs/issues if you do discover any newer issues. I will also dig into this and see if there is something wrong with the logical-flow.

    Thanks again!
     
    Last edited: Jan 8, 2017
  17. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    v1.6f5 Released
     
  18. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    653
    Hi i noticed your asset today. I have to be honest im not entirely sure what a nested prefab is/does.

    What i need is a prefab with a script component that saves reference of other prefabs. Currently this would mostly be for ui Elements. Keeping all references in a script to all the ui elements attached to it. Does this this asset do that ?
     
  19. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @JBR-games nested prefabs is the ability to have a deep hierarchy of prefabs where you can apply & revert changes to nested (or hierarchical n+1) deep prefabs. For instance, if you have a Forest prefab that has a collection of tree prefabs, Unity will lose the reference to the tree prefab when you apply and make the "Forest" prefab. Any changes you make to the tree prefab asset will not be reflected on those instances.

    uPrefabs resolves this issue by allowing you to always revert or apply components or entire object hierarchies no matter how deeply nested they are.

    Hopefully that answers your question!
     
  20. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    v1.6f5 is currently on sale now in the Asset Store until 1/9/2017 at 3PM (CST)
     
  21. Deleted User

    Deleted User

    Guest

    Hi, I recently bought uPrefabs. It's been working so far, but I noticed that creating hundreds of child objects for a game object made from a uPrefab is terribly slow. I tracked it down to uObject.OnTransformChildrenChanged which calls either uPrefab.OnProcessChildren or uPrefabChild.OnProcessChildren.

    As I understand these functions, they need to be called when creating new nested prefabs and does not contribute in any way during play mode. For now, I just skip the call: if (!Application.isPlaying) OnProcessChildren();

    Will there be any consequences in play mode by skipping this? I tested for a while and did not notice any weird behavior. If I understand it correctly, the uObject is just used to help identify uPrefabs during play mode and should do nothing else.

    darkForester, please let me know if it's okay. Because waiting for 40 seconds after pressing the play button is unacceptable :(

    Thanks
     
  22. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    Thanks for the information @michalferko. I will definitely track that down and resolve it. uPrefabs only matters during edit time.

    In the future please feel free to use our Issue Tracker at: https://bitbucket.org/antiherostudios/uprefabs/issues?status=new&status=open
     
  23. Ultramattt

    Ultramattt

    Joined:
    Jan 13, 2015
    Posts:
    22
    We have run into an error with UPrefab where we have multiple Sphere colliders on a single object. We went in to uPrefabUtility and modified the getmodifiedcompononets method to keep a list of modified components that have already been checked. So it basically keeps a list of multiple components. This fixes the error.
     
  24. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @Ultramattt would you mind sending me your fix to devon@antihero-studios.com? I'd love to take a look at it and see if there are other places I could improve for these types of use-cases.

    Thanks,
     
  25. Ultramattt

    Ultramattt

    Joined:
    Jan 13, 2015
    Posts:
    22
    public static List<Component> GetModifiedComponents(GameObject instance, GameObject asset) { List<Component> dirtyComponents = new List<Component>(); List<int> checkedAssetIds = new List<int>( ); foreach (Component instanceComponent in instance.GetComponents<Component>()) { if (instanceComponent == null || checkedAssetIds.Contains( 0 )) { continue; } if (typeof(Transform).IsAssignableFrom(instanceComponent.GetType())) { continue; } if (typeof(uObject).IsAssignableFrom(instanceComponent.GetType())) { continue; } Type componentType = instanceComponent.GetType(); Component assetComponent = asset.GetComponent(componentType); if (assetComponent && !checkedAssetIds.Contains( assetComponent.GetInstanceID( ) )) { var processors = uPrefabComponentProcessor.FindAll(componentType); checkedAssetIds.Add( assetComponent.GetInstanceID( ) ); for(int i = 0; i < processors.Count; i++) { bool isModified = processors.OnCheckIfModified(componentType, asset, instance, assetComponent, instanceComponent); if(isModified && !dirtyComponents.Contains(instanceComponent)) { dirtyComponents.Add(instanceComponent); } } } }
     
  26. mafiadude1

    mafiadude1

    Joined:
    Jun 28, 2012
    Posts:
    59
    What if I have a bunch of uPrefabs spread across multiple scenes. And those prefabs have mutually-exclusive prefabs underneath them. What would be the easiest way to update all of those prefabs (and children) across all of my scenes when I have made changes to the original in my project view? Would i have to open all of my scenes and revert them all individually?
     
  27. Ultramattt

    Ultramattt

    Joined:
    Jan 13, 2015
    Posts:
    22
    Yes, you will have to open all your scenes and worse, you will have to click on each of those game objects and Revert them. We just ran into this problem as well. There needs to be a way to make linked Prefabs. So that when you open a scene it will SYNC with the Project prefabs.
     
  28. tito91

    tito91

    Joined:
    Aug 30, 2015
    Posts:
    10
    Hello, I'm having some problems with the plugin. It does it's job in most cases but there are some issues I've notices. I'm using version 1.8f0.

    The first one is handling multiple components of the same class on the GameObject. When I add first component X to the object it's fine, the name in hierarchy turns green, I can apply then and it's stored in the prefab. But when I add the same component for the second time, the name does not turn green as if there were no changes made on the component.

    The second issue is connected with static flags. When I change the flag on a child prefab, it does not change in the instance under the parent prefab, as if the system did not notice the change. Static flag set in the instance under the parent has value that was set at the moment of adding this child to the parent, and does not change anytime later.

    BTW, earlier I've ran into a problems with components that have non initialized collections as a class fields (both arrays and lists) and e.g. Revert caused null reference exceptions. I've managed to work this around myself by creating empty collection when system run on a null one.

    @darkForester, could you please help with this issues?
     
  29. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @mafiadude1 @Ultramattt It's great to hear an edge case where we can improve the product. In the future, please don't hesitate to request improvements to the product via the Issue tracker: https://bitbucket.org/antiherostudios/uprefabs/issues?status=new&status=open

    @tito91 Thanks for reporting these issues. In the future, we track all of our product bugs and issues via the Issues Tracker here: https://bitbucket.org/antiherostudios/uprefabs/issues?status=new&status=open. Please feel free to create those issues and I can take a look into them!

    I appreciate your continued use of the product and we will continue to improve it!

    Thanks again,
     
  30. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @Ultramattt @tito91 As a follow up to the multiple component issue, I have just submitted v1.8f1 to the asset store (will take about a week to release) which resolves that issue.

    I have also addressed some of the null reference exceptions that are caused by uninitialized arrays / ILists.

    @tito91 I will continue to investigate the static flags issue and address it in a timely fashion.

    Thanks!
     
  31. Kupper

    Kupper

    Joined:
    Apr 6, 2014
    Posts:
    1
    This plugin is exactly what I have been looking for, but I keep encountering some NullReferenceExceptions when I Revert Object of a prefab from the project folder:
    NullReferenceException: Object reference not set to an instance of an object
    AntiheroStudios.uPrefabs.Editor.uPrefabRevertUtilities.RevertAllObjectInstances (AntiheroStudios.uPrefabs.uObject asset) (at Assets/_Essentials/AntiheroStudios/uPrefabs/Editor/uPrefabRevertUtilities.cs:382)


    The same happens when I Revert Transform of a prefab in the project folder:
    NullReferenceException: Object reference not set to an instance of an object
    AntiheroStudios.uPrefabs.Editor.uPrefabRevertUtilities.RevertTransformOnAllObjectInstances (AntiheroStudios.uPrefabs.uObject asset, Boolean revertPosition, Boolean revertRotation, Boolean revertScale, Boolean revertAnchorPosition, Boolean revertOffset, Boolean revertPivot, Boolean revertAnchors) (at Assets/_Essentials/AntiheroStudios/uPrefabs/Editor/uPrefabRevertUtilities.cs:169)


    Due to this (I assume) none of my nested prefabs gets updated with the changes made. Unless I go to the nested prefab in the Hierarchy and manually Revert it from there, but then I will have to do this for all of the nested prefabs, and the purpose of this plugin loses it's meaning.

    When I change the sprite of a Sprite Renderer and applies this change, then ALL the copies of that prefab gets the change applied, regardless of how deep it is nested, but I still get a NullReferenceException though:
    NullReferenceException: Object reference not set to an instance of an object
    AntiheroStudios.uPrefabs.Editor.uPrefabRevertUtilities.RevertComponentOnAllObjectInstances (AntiheroStudios.uPrefabs.uObject targetObj, UnityEngine.Component refComponent) (at Assets/_Essentials/AntiheroStudios/uPrefabs/Editor/uPrefabRevertUtilities.cs:465)


    I hope you have a solution for this issue :)

    Regards
    Kasper Topp
    CEO at Dane Games
     
  32. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @Kupper My apologies for any issues you have seen. v1.8f1 will soon be released on the asset store and may solve some of these issues. However, I will take a look into them to ensure that they can be resolved.

    In the mean time, the best way to track bugs and issues that arise is through our issue tracker here: https://bitbucket.org/antiherostudios/uprefabs/issues?status=new&status=open

    By using the issue tracker, we'll get instantly notified of your issue and can resolve it. If you would be willing to create a new ticket there and copy & paste your message, we can provide updates through the tracker.

    Thanks!
     
  33. tito91

    tito91

    Joined:
    Aug 30, 2015
    Posts:
    10
  34. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @tito91 I have just resolved this issue and will submit the fix to the asset store.

    Thank you!
     
  35. tito91

    tito91

    Joined:
    Aug 30, 2015
    Posts:
    10
    @darkForester Today finally I had some time to update plugin and test against the issues. It seems that all four of them are resolved in 1.82. Thanks! :)
     
  36. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @tito91 That is great to hear. Please let me know if there are any other issues you run across!
     
  37. matexpol

    matexpol

    Joined:
    Mar 17, 2014
    Posts:
    1
  38. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @matexpol I will take a look right away. Thanks!
     
  39. tito91

    tito91

    Joined:
    Aug 30, 2015
    Posts:
    10
  40. mikemonroe_oc

    mikemonroe_oc

    Joined:
    Dec 7, 2016
    Posts:
    4
    I just bought this and am pretty confused as to its workflow.
    I'm using 5.6.1f1 and it seems to have completely hidden the Select/Revert/Apply buttons in the inspector for the pre-existing prefabs I already had in the project. Is this intended behavior somehow??
     
  41. darkForester

    darkForester

    Joined:
    Sep 19, 2013
    Posts:
    80
    @mikemonroe_oc I just saw your question. It will hide those buttons because the behaviour has changed for how prefabs work. You should be able to resolve this issue by right-clicking on your prefabs in the project window and re-importing them. The plugin will detect this and add the appropriate scripts.

    Let me know if you have any issues.

    Thanks!
     
  42. Bubagent86

    Bubagent86

    Joined:
    Jan 3, 2014
    Posts:
    10
    Hey are you guys still supporting this plugin? I'm getting frequent crashes when I try to apply or revert prefabs in 5.6.
     
  43. Bubagent86

    Bubagent86

    Joined:
    Jan 3, 2014
    Posts:
    10
    (and in 17.1 and 17.2)
     
  44. tosiabunio

    tosiabunio

    Joined:
    Jun 29, 2010
    Posts:
    115
    Is this asset dead or not? I would like to use it but it should be alive and kicking (or at least kept compatible with new versions).
     
  45. a52

    a52

    Joined:
    Mar 15, 2018
    Posts:
    1
    I would also like to know if this is continuing to be worked on. I'd love to use this plugin, but I'm leery of spending twenty bucks on something that's potentially outdated.

    If it is being maintained, thanks so much for making something so useful!
     
  46. tosiabunio

    tosiabunio

    Joined:
    Jun 29, 2010
    Posts:
    115
    I gave up waiting for response and went with Nested Prefabs. That asset is being actively developed and the developers are very active.
     
unityunity