Search Unity

[Official] Share your Prefab Workflows!

Discussion in 'General Discussion' started by nikolinehoegh, Jun 14, 2017.

  1. MCSilver

    MCSilver

    Joined:
    Apr 6, 2017
    Posts:
    4
    Complex topic...

    I'm not good at explaining and i'm not a Unity professional pro.

    Generally i would like if Prefabs are more flexible and dynamic. But manly i use it for Grab&Dropping&Copying and Updating my Stuff... but once the Prefab get large and they start to have a family and get children and different types like: Custom Child-Gameobjects, Custom Components at subtree level. The Connection breaks ... and its not possible for me to update the Prefab without destroying something. Maybe im doing something wrong...


    I would like to have something similar to OOP in Programming Languages.

    You have a Base Prefab from this all children inherit.
    The BasePrefab have a certain Subtree which is always the same for all Children.
    But the Children can add own SubTrees to it. (GameObjects, Components)

    If you Update your BasePrefab, only the GameObject/Components are updated, if you Update the ChildPrefab they get updated.
    And additionally i had something in my mind like.. flags: Locks, Dont Update,Ignore Changes, Only Apply this+Subtree, Only Revert this+Subtree.

    Example:

    BasePrefab:

    -- BaseAirplaneTerminal
    ----AirplaneMesh
    ----Interactive
    ------UI Input Canvas
    ------3D Input
    ----Feedback

    ChildPrefab/InheritPrefab:

    -- AirplaneTerminalTypA : BaseAirplaneTerminal
    ----AirplaneMesh
    ------Additional TypA Mesh
    ----Interactive
    ------UI Input Canvas
    ------3D Input (+ComponentA)
    ------TypA Input
    ----Feedback
    -----LightA1
    -----LightA2


    -- AirplaneTerminalTypB : BaseAirplaneTerminal
    ----AirplaneMesh
    ------Additional TypB Mesh
    ----Interactive
    ------UI Input Canvas (+ComponentB1,ComponentB2)
    ------3D Input (+ComponentB)
    ------TypB Input
    ----Feedback
    -----LightB
    -----UI MessageB
    ----FirstAidKidPrefab
    -------FirdAidKidSubtree


    Different Question: What if you want to Remove one GameObject/Subtree on your Prefab but still want to Update all other Changes.... maybe with a ingore flag?

    -- AirplaneTerminalTypC : BaseAirplaneTerminal
    ----AirplaneMesh
    ------Additional TypC Mesh


    A Super Duper Dynamic Flexible Way, where you can do everything with it and you can still update all your stuff you want.

    ----

    Edit:
    Reading this again ... i realize that you can do it by scripting it yourself, that you can manage the gameobjects/subtrees. But maybe there is a smart way to combine things, in earlier posts there was the mention of a prefab editor maybe just add a scirpting tool it? so that game designers/artists can do there stuff and the developer have a way to support it.
     
    Last edited: Jul 27, 2017
  2. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,383
    I didn't bother posted feedback as I was waiting to see the demo's... but I been waiting for a 2months now....

    "We will be posting demos here as development continues, so stay tuned!"

    So whatever happened to that... let's see some demo's.. we can have a vote on what looks good for the direction of nested prefabs and I might provide some feedback.
     
  3. nikolinehoegh

    nikolinehoegh

    Unity Technologies

    Joined:
    Sep 22, 2014
    Posts:
    6
    Checking in with this thread and letting you guys know that we are still reading your feedback. As we progress, we want to involve you along the way.

    Some of you have asked about what the goal of this discussion is, and how we gather and use the information. So let me be a bit more transparent on that. We are currently developing improvements to the prefabs system, and in order to do that, we collect feedback from many sources. Our researchers and evangelists speak to studios and game devs, and share information. The prefab team also speaks directly to Unity users, through forum posts like this, emails, Unity user meet-ups and Unites.

    We ask what issues people have with the system in order to find the improvements that really matter to their production. Some problems we know need to be solved, such as nesting, but how to design the system really depends on your use cases.

    We're working on a build to share, but not surprisingly, the technical changes are not trivial, and we want to share something that you can actually use.

    Meanwhile, how do you think that nested prefabs will change the way you structure your game? You could basically make an entire level a prefab, if you wished to.
     
    TheSecretGordon, BAIZOR and Baste like this.
  4. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,125
    Making levels into prefabs is not quite there yet even with nested prefabs, as light settings and some other meta-data are still tied to the scene file.


    I just broke our game's menu because I pressed apply on a button in our menu, without realizing that it was a general button prefab instead of a loading menu prefab. I'm already feeling the pain in our next game's GUIs - we want to put elements that are shared across different views into prefabs, but the natural thing is to put the entire view into a prefab so it can be loaded conveniently.

    We're probably going to end up using additive scenes as pseudo-prefabs. It's a lot less convenient than prefabs (we have to load the scene additively, and then move all of it's objects to the dontdestroyonload scene), so if a nested prefab preview is ready, that'd definitely be a use case.
     
  5. tswalk

    tswalk

    Joined:
    Jul 27, 2013
    Posts:
    1,106
    I personally believe that "nested" prefabs is a waste of time and will just over-complicate things. It does not in my mind solve any particular problem.

    Having a separate editor for prefabs is going to be problematic when those prefabs are UI objects as they are heavily dependent upon the properties of the parent (like a prefab panel that gets placed into a scenes' canvas)...

    The current issues I have with prefabs:
    * you can only traverse to a single depth in the prefab hierarchy... which is pointless and requires one to just put the thing into a scene to view anything of greater depth.
    * prefab components do not save references to scene objects. I do not even know how you will overcome that.
     
    Dennis_eA and Murgilod like this.
  6. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    110
    it's hard to see this thread and not feel like you're being trolled - prefab improvements have been on the roadmap for a good long while now, but it seems like you guys are on a vision quest for the perfect solution and so release nothing. it's understandable with a product like unity you can't just release (or, importantly, remove or change) features willy nilly, but the workflow and issues have been consistent for a good long while now; start simple and build slowly. personally i'm partial to the feature set edy posted here and what Baste has said in this thread. anyhow, to sum up my own feels:

    1. super awesome nesting features would be lovely. but you could start simple and allow simple viewing and selection of the entire hierarchy of any nested prefabs. while i'd like to be able to conveniently edit everything in place and it all makes logical sense and "just works", again, you don't have to start with perfect. just let me nest things together, view, and select to go to the nested prefab root to edit if needed.

    2. like many, many have said before, allow folding out of the entire prefab hierarchy in the project view. there's been confusion on this subject going back 10 years or more now. i came across this issue myself again today and was totally surprised, i thought it had been "fixed" with the extra window trick years ago. not only is this a major workflow annoyance, it blocks you from doing certain things in the editor that technically should be allowed.

    for example, i am working on an ECS blueprint system using scriptable objects (end the tryanny of the MonoBheaviour and all). i have a bunch of enemy prefabs with a MeleeEnemyBlueprint. one of the components in this blueprint should reference a transform on the prefab. if that transform is nested deeper than the first level, the "drag to scene and apply changes" trick doesn't even work:


    https://gyazo.com/09ce4823fcf3c38a9ea1ad50bd52bcf0

    while i also think prefabs and scriptable object assets should be able to reference things in the scene (they're all just assets, after all, and you guys have been showing off ExposedReferences as a solution for things like Playable assets), i can live without that feature. however, anything that lives at the project level should be able to work in this way and it's inconsistent that it doesn't work in this particular case.

    cheers, i'll timidly follow this thread for any updates :)
     
  7. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,306
    Wtf? You just do it on the prefab in the scene, then apply the prefab.
     
  8. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,762
    Why should you have to deal with the added step of dragging prefabs into the scene when you should be able to do it right from the inspector? This is one of the big problems with prefabs: only being able to explore one level deep and constantly having to drag into the scene to get things to work.
     
    Last edited: Sep 30, 2017
  9. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    110
    this is not an option if the reference lives in an asset like a scriptable object. see the linked gif for reference.
     
  10. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,306
    Is see because it's exposed in an editor script? Assets don't know anything about what's in the scene, because they're on your hard drive. That exposed var is still part of an asset, I guess.

    Shouldn't it work if you only use the ZomBear in the scene? It would still be a local object.
     
  11. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    110
    @Stardog it's because i've designed my notion of blueprints to be saved as assets. i had a version working where the SO was saved with the scene / gameobject, but serialization quickly turns into a sticky issue when you do something like decide to turn your gameobject into a prefab. i had a version of the framework going where this sort of workflow was possible, but i found it difficult to get things working as well as a basic MonoBehaviour does. this is frustrating because on the serialization side of things a MonoBehaviour and a ScriptableObject are very closely related and in theory this should all be fairly simple to support.

    unity has shown some eagerness to improve on their original take on ecs. @Joachim_Ante gives some insight here:



    it seems at some level everything will still be tied to transform + gameobject. we'll see :/ baby steps i guess.

    to be fair my criticism is nuanced and there are many ways this could be solved. the basic thing i am trying to do is provide an inspector for data that can be attached to / associated with any serializable object, whether it lives in a scene or an asset at the project level. i know some developers want better support for their POCOs for this, personally i am fine using scriptable objects if the support was there.
     
  12. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    6,049
    I use prefabs for almost everything. For example, I am making a sailing ship game with 40+ different ships. The models and scripts with ship specific inspector settings are attached to a lower level gameobject, and the highest level gameobject has rather generic ship control scripts with settings common across all 40 ships. Nested prefabs would be helpful in that when I make a change to the top level gameobject I wouldn't have to duplicate that change manually across all 40 ships. Not a huge issue yet for me as I'm primarily developing using just a few of the 40 until I have everything pretty much done, but after release of the game I'm dreading any major changes to the top level gameobject for these ships.

    Yes I could make them separate gameobjects and have the top level instantiate and then make child the lower level, but there are other technical reasons why that is not optimal related to UNET specifically.
     
  13. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    251
    Basically, for everything, i see them as the Unity's great advantage in fast and efficient workflow. I create reusable scene prefabs in scene view, than save them as prefabs to be called by spawning when needed.

    Here's an excerpt from my devlog on nesting prefabs and how it hampers my workflow:

    I must admit, though i am passionate about making a game, some things are quite tedious. I’m having problems with making enemy squadrons, and the way i make them is so boring and uninspiring it really halts my progress.

    Before i was well into Unity engine limitations on nested prefabs (only one child per object, i.e. child cannot have it’s own child as a prefab, only when instantiated on runtime due to way serialization works) i thought it was going to be a breeze, i just drag and drop enemies in a formation, put them under a parent prefab and voila! Except it doesn’t work like that. All of my enemy prefabs typically have two children, Gunpoint and Thruster. Gunpoint hold the shooting logic and muzzle flash animation, while Thruster has the, well, thruster animation. It is on a separate object to avoid being colored with the rest of the enemy ship when it changes color on hit by a player weapon.

    So i guess i’ll keep my work and make an empty squadron prefab which will spawn and then spawn the enemies in a desired pattern coded into it. That’s all nice and dandy until you actually start working that way. No more cosy drag and drop, just selecting what to spawn, input coordinates and hit play too see what you’ve done. If something’s not positioned correctly (it usually isn’t), reposition the enemy, copy the coordinates, stop, and paste them. Repeat 10 times for 10 enemy objects in a squadron, and i should have hundreds of them! Horrible!


    So i decided to change my ways. I need to make a reverse approach. Instead of creating an enemy prefab with all the children attached, i’ll attach the Gunpoint and Thruster on instantiation, which is only a two step process compared to setting the position of multiple enemies inside the squadron. This way, i have a clean enemy prefabs without children which i can joyfully drag and drop into positions i want and simply save them under a prefab which will be used for spawning.

    Though it is a bit more work initially, it provides an immense saving of time later and makes it more visual, fun and intuitive to work with.

    But not as fun as it could be if i was able to simply group the enemies with all their children in the squadron prefab!

    No, i don't want to depend on something that is uncertain to work sooner or later.
     
    TheSecretGordon likes this.
  14. TheSecretGordon

    TheSecretGordon

    Joined:
    Dec 1, 2015
    Posts:
    1
    • What are you currently using prefabs for? What is your workflow for creating these prefabs?
    Having been burned by the current prefab system on previous projects, we now use them as little as possible. Being able to have multiple scenes loaded has reduced some of our need for them.

    Previous project: Master scene with prefabs for each of the main systems like UI, Audio etc. so that multiple people could make changes to different systems at the same time. Yuck. On the current project we just have separate scenes for all the main systems and load them all at once. This seems to be working well.

    On the current project we only use Prefabs for our minigames. (Our Minigames are unique games that temporarily replace the main gameplay). These are created as prefabs in their own scenes, then instantiated into the level as required and deleted when we're finished with them. On the next project I think I'll try to do this by having them in separate scenes instead.
    • Are there limitations, gaps, or issues when using Prefabs in your workflow?
    I guess this more of a request for Xref-ing, but the idea is very similar to Prefabs. What I want to do is create a Gun prefab (has sound VFX etc.) then create a Solider prefab that has the Gun prefab nested within it, then maybe create a Squad prefab that has multiple soldiers nested inside. If I change the audio on the Gun then I shouldn't have to manually propagate that up through my other prefabs, it basically makes the whole notion of prefabs useless. (Or the same idea with UI: Create a button, then make a Confirm Box prefab that nests a couple of the button prefabs etc.)


    Being able to set unique values on each prefab is a cool idea, but even just being able to Xref without changing params would be extremely useful.

    I think part of my issue with the Prefabs is that they just don't work the way you'd expect, so everyone using Unity has to go through the same cycle of: finding out about them, using them for everything that intuitively makes sense, hitting the problem with nested prefabs not working, getting frustrated and spending time working around them (probably finding a thread like this on their way), and then finally abandoning/minimising them in the next project.

    • Are you currently using any Asset Store plug-ins for Nested Prefabs? What problems does it solve? If you wrote your own, what does it solve that others don’t?
    We do not use any plug-ins for prefabs, it's too fundamental a concept to risk on a store asset.


    Incidentally, I agree with a previous comment that Unity should provide their own pooling system. Just about every project will need one in the end, and having one provided would make things a lot easier (and stop a lot of the 'Why does my framerate stutter when I fire a missile?' type posts)

    Personally I think it's completely outrageous that it's been 8 years since the issues with nested prefabs were first raised, and whilst it's great to hear that Unity is looking into this now I have little cause for optimism that we'll see any improvements in the short-term, but I look forward to hearing more!
     
    Last edited: Oct 12, 2017
  15. Stardog

    Stardog

    Joined:
    Jun 28, 2010
    Posts:
    1,306
    You are almost doing it like Entities in half-life. They're just a placeholder object, then you loop through and replace them at runtime with the prefab. Your formations can just be a parent with cubes that represent the enemies.
     
    Martin_H likes this.
  16. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    251
    Sure, it can be done like that too, but i like the concept of nested prefabs more, it's like playing with building blocks.
     
  17. Oshigawa

    Oshigawa

    Joined:
    Jan 26, 2016
    Posts:
    251
    Great post, you were spot on. The inability to use nested prefabs greatly hinders their usability, they could increase productivity multifold. Pooling also sounds good, it should be integrated, even noobs need pooling after few weeks of using Unity. Sure, the Asset Store keeps the income flowing, but there are already a tons of free solutions.
     
  18. xellfish

    xellfish

    Joined:
    May 25, 2014
    Posts:
    10
    Our biggest gripe right now are FBX prefabs, I think they are broken in a very fundamental way. They way I understand it, when you import an FBX it automatically gets turned into a mostly uneditable (there are some settings in the importer) pseudo Prefab, which seem almost entirely useless to us.

    It's simple enough for static meshes, since you can just create your own Prefab with a Static Mesh Renderer and link the mesh from the Pseudo Prefab in, and completely ignore the original Pseudo Prefab. At best that makes them just superfluous, at worst that makes them dangerous, because our Designers sometimes accidentally actually use them. Causes us to have to go through the scenes and replace them with real Prefabs, so that we have a chance to actually edit those Prefabs later on.

    It's much worse with Skinned Meshes though, because their Psuedo Prefabs seem to have some hidden properties which makes it impossible to replicate them using real Prefabs, so you have to use them. Except you really can't, at least not properly. You can duplicate them, which turns them into real Prefabs, but unlike with static meshes you lose any reference to the original mesh, so if that gets changed your Prefab is broken, and needs to be created (and replaced in every scene!) from scratch. The really mean part is that there are several cases where the Animator basically requires you to add Components to the Animator prefab (for example for animation events, or to use root animations), and afaik the only way to do this without scripting workarounds is to duplicate the FBX (which breaks the import pipeline).

    Currently we are working around this by never placing any skinned meshes into scenes ever, and instead put reference objects there. Those reference objects in turn reference what we call "Proxies", which are Scriptable Objects that have a reference to the actual Pseudo Prefab, and have a "Instantiate" function which creates an instance of that prefab at runtime and adds all additional components per script. So essentially we don't use Prefabs for Skinned Meshes at all. I don't think even nested Prefabs would solve this issue (since for Animators, some components can't be on the parent).
     
    oobartez and Martin_H like this.
  19. Hi.

    I'm a professional Unity developer, but mostly working with c# stuff (I've used prefabs etc much more in my "hobby"-work), so apologies if I'm simply doing something stupid below:)

    What are you currently using prefabs for? What is your workflow for creating these prefabs?

    We used prefabs in the UI.
    E.g., there's an "OK Button" prefab (E.g., add a button to a canvas, name it, change the text, drag it to prefab folder).
    Now I'll make a popup dialog: make a panel, "hello world" placeholder text, then drag my "OK Button" prefab onto it.
    So now I'll make my "popup panel" a prefab by dragging that into the prefabs folder too (but, see below).

    Are there limitations, gaps, or issues when using Prefabs in your workflow?

    Now, a new canvas to demonstrate the problem I'm having:
    I drag my "PopupPanel" prefab onto the canvas, and also my "OK Button" prefab.
    So, there are two OK buttons in my scene now, one is "in the root" right "under" the canvas, the other is on the panel:

    Canvas
    .\-PopupPanel
    ...\-OkButton
    ...\-Hello World Text
    .\-OK Button

    Now I go to my prefabs folder, and change the text on my "OK Button" prefab from "OK" to "YES PLEASE!":
    The text on my "root" OK button changes as I'd expect, but the text on the OK button "embedded" inside the "Popup Panel" prefab does not.
    ^^^This is a somewhat over-simplified example. In the real world, I think I was trying to add a localization component to the text on the OK button, rather than manually alter the text.

    I believe this can be worked around by making the popup a scene, and additive-loading it, but I think that only gives one level of nesting. <<This is what I'll be trying in my hobby project though, I think.

    Another issue

    A general problem I've had with prefabs is, If I change the prefab, in a largish project, I'm not always confident of the outcome. I don't necessarily know who else on my team has "overridden" stuff in their scenes. So, maybe I change the font-size of the OK button, but the change isn't applied globally as someone else fiddled with the version they had in their scene. This is especially sad if they changed it, didn't like it, then changed it back again (but manually, rather than using "revert to prefab").

    Are you currently using any Asset Store plug-ins for Nested Prefabs

    No, and I'm not sure there are enough positive reviews to convince me to try one. It feels like such a "dangerous" thing to do, if stuff gets messed up outside of my control; or, I end up wedded to some 3rd-party plug-in that the author then abandons and it stops working.
    However, this:

    does look very nice, and the video explains how they "fix" exactly the problem I'm having.

    Another example
    In my own game, I have a prefab for a vehicle-model.
    This is nice, as it lets me change the paintwork or whatever.
    So I drag the prefab into my scene, and add a load of stuff to make it a driveable vehicle.
    I'd now like to make a "driveable vehicle" prefab.
    I'll end up with several "driveable vehicle" prefabs that have different "physics" attributes.
    But now I've lost the "connection" to the original vehicle-model prefab. Any changes to the vehicle-model won't affect my "driveable vehicle"s.
     
    DanielVanches likes this.
  20. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    225
    I have nothing to contribute to this thread, but I just want to say that asking the game developers about your what to do next is absolutely the best choice you have made in the last couple of years.

    Thank you and I expect the same kind of suggestion-seeking behaviour from the team that develops scripting.
     
  21. devotid

    devotid

    Joined:
    Nov 14, 2011
    Posts:
    355
    I would just love to be able to "bulk apply" as I have about 30-40 prefabs that I have to manually hit "Apply" after a change. I would love to be able to highlight all of the "updated" prefabs and hit apply once. Other than that I have been happy with the prefab system.
     
  22. tbriley

    tbriley

    Joined:
    Sep 10, 2013
    Posts:
    110
  23. interpol_kun

    interpol_kun

    Joined:
    Jul 28, 2016
    Posts:
    72
    Unity needs real prefab and particle effects editor (and of course UI editor).

    Look at Unreal Engine and steal some ideas from there. It's not very nice to drag prefabs on the scene every time you want to change something.
    For me, it will be nice to see the scene as a canvas for your level. Other things like editing prefabs, UI, particles and materials should be in other, dedicated to them, windows.

    And of course there should be nested prefabs.
     
    Player7 likes this.
  24. Mr_Dan_O

    Mr_Dan_O

    Joined:
    Oct 12, 2013
    Posts:
    343
    I guess it would be useful to add an ability to create and save prefabs at runtime to Unity3D.
     
    Martin_H likes this.
  25. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,383
    I agree
     
  26. Quatum1000

    Quatum1000

    Joined:
    Oct 5, 2014
    Posts:
    713
    As a pro user paid for unity I want to have a unity solution prefab get correctly updated by importing a model and update the references of prefabs to the first level.

    As a max user with a license from 2011 to 2015 I do not want pay thousand of $ for new license for 2017,2018 and additional cost to update my plugs in for max as well.

    The current internal importer with max/fbx files has many issues and in the first row, that there is not option prevent importing meshes are hidden or it's simply does not work.

    Using prefabs kindergarden kids could learn in about 2 days. But updating prefabs by updating or importing models is a mess in unity.
     
  27. Lo0NuhtiK

    Lo0NuhtiK

    Joined:
    Jan 29, 2012
    Posts:
    9
    Yes. ... Prefabs that work just like in hierarchy.
     
  28. Rasly2

    Rasly2

    Joined:
    Feb 19, 2015
    Posts:
    211
    Not sure if troling. Anyway my experience with asset shop was not very good even such good rated assets like prefab evolution are not useable for serious projects.

    I dont get what is problem with nested prefabs.. all you need to do is not touching nested prefabs children and scripts.
     
    Last edited: Jan 15, 2018
  29. HarvesteR

    HarvesteR

    Joined:
    May 22, 2009
    Posts:
    496
    Adding my feedback here. I use prefabs extensively for pretty much anything that needs to be spawned into the scene.

    Like most everyone here, I also run into the usual difficulties with the current prefab system, most importantly:

    * Editing prefabs in the project (without bringing them into the scene) is limited to the first level of their hierarchies.
    * Nested prefabs aren't supported.

    I went as far as writing an editor tool for myself called NestedPrefabSpawner. It isn't a good tool though, and requires you to remember to manually de-spawn the nested prefabs before applying any changes to the parent, lest the spawned copy be written into the parent object.

    I haven't ever tried any prefab solutions from the asset store though. My prefab experience so far has been pretty much completely 'vanilla'.


    Cheers
     
  30. robertseegrist

    robertseegrist

    Joined:
    Jan 4, 2016
    Posts:
    7
    I just published my game to XBox Creators Program.

    An actual finished product.

    I never use prefabs except for the ones I get from the asset store.

    Even then, I immediately Break Prefab Instance and have a section in my Hierarchy named prefabs. These are not actual prefabs, but Gameobjects that I keep in my Hierarchy and use a script to deactivate when the game starts.

    I then use code to instantiate these "Prefabs" and set the clone active.

    clone = Instantiate(objectInHierarchy, desired.transform.position, desired.transform.rotation);
    clone.setActive(true):

    Personally, I feel prefabs are only useful for content creators on the asset store.
     
  31. Player7

    Player7

    Joined:
    Oct 21, 2015
    Posts:
    1,383
    And even then I've opened asset store projects only to find broken prefabs.. and missing script.. ..who the F*** knows what the script that was, probably in the project somewhere but you'd spent a while guessing.
     
  32. TSI25

    TSI25

    Joined:
    Sep 22, 2013
    Posts:
    9
    We have a project that is essentially a trivia game consisting of a series of menus that we need to make work on WebGL with the smallest amount of memory possible. To accomplish this the workflow we attempted to use was to pack each of those menu prefabs into an asset bundle so that we could load and unload them as they were needed, and thus keep as little as possible loaded as possible at any given time.

    The problem we ran into with this workflow is that it seems to be impossible to change the prefabs that have been packed into the bundle after the bundle is initially made. Deleting the bundles and rebundling them seems to yield a bundle with the original prefab and not the updated prefab. We have submitted a ticket and a repro project which you can find here https://issuetracker.unity3d.com/is...asset-bundle-fails-to-update-after-rebuilding but it has gone largely ignored aside from an initial response saying that the team verified that it was a problem. We have since verified this bug in 2017.2.1p1, 2017.3.0f3, 2017.3.1f1, and 2018.1.0b1, and it is holding up two of our production projects.

    I'll attach an asset package containing the repro project, you can reproduce the issue by visiting the above link and following the instructions. We are either doing something wrong with how we are trying to bundle individual prefabs, or it just seems really broken.
     

    Attached Files:

  33. cl0n

    cl0n

    Joined:
    Sep 9, 2015
    Posts:
    10
    Prefabs are fabulous, One thing I feel missing is the linking. I wish I could directly link a gameObject from Inspector to prefab.
     
  34. cfree

    cfree

    Joined:
    Sep 30, 2014
    Posts:
    59
  35. ChazBass

    ChazBass

    Joined:
    Jul 14, 2013
    Posts:
    120
    I use prefabs extensively. In fact, in any given scene there is exactly one game manager object whose sole responsibility it to build the entire scene through the instantiation and explicit initialization (i.e. no use of default Start() or Awake() methods) of prefabs for all other parts of the scene from the player/actor instances, to sub-system managers, UI, and (in the case of procedural generation) the game world itself. In fact, in many cases, there is only one scene in my entire game. So, in effect, this use of prefabs allows for me to use Unity in largely a headless manner.

    This current Unity account is only a few years old, but I have been using Unity since early 2009. My biggest fear in all the work that will surely have to go into handling nested prefabs (which I personally have no use case for) is that this will destabilize the current prefab functionality. For many years, for example, there was a constant issue with prefab references being randomly lost, and it took a long time for Unity to tame that beast. I worry that we will have to relive that period to some extent if the whole prefab system is redesigned and reimplemented.

    Since Unity seems dead set on going forward with this, I very much hope that sufficient QA and alpha and beta testing is applied during the process.

    Regarding the viewing and updating of prefabs within the prefabs folder or sub-folders, I do agree that being able to see more that two levels down in the hierarchy would be handy. As a work around, a separate editor pane would be fine. I agree that having to drag them into the scene, update them, and click an apply button, and then delete them is a bit obnoxious, especially for someone who uses prefabs as much as I do.

    Lastly, to explain a bit more: The reason I have no use case for nested prefabs is that I take a very data driven approach to my game architecture, nearly ECS like. However, for others who do not take such an approach I can certainly see the value in nested prefabs. Again, my only fear is that I think this will be difficult to pull off both from a development and QA standpoint.
     
  36. zoran404

    zoran404

    Joined:
    Jan 11, 2015
    Posts:
    519
    @ChazBass If all you have in your scene is a GameManager then how do you place your prefabs?
    Do you have a bunch of ScriptableObjects that hold the info that will otherwise be in the scene?
     
  37. ChazBass

    ChazBass

    Joined:
    Jul 14, 2013
    Posts:
    120
    I do a lot of procedural stuff so the game manager spawns builders which load their parameterization from scriptable objects and prefabs. Static information is also stored in scriptable objects and prefabs.
     
  38. joshcamas

    joshcamas

    Joined:
    Jun 16, 2017
    Posts:
    756
    Having the ability to edit prefabs / view a visual of it would be SOOOO useful!!!!
     
  39. warreneng

    warreneng

    Joined:
    Mar 13, 2017
    Posts:
    8
    I dream of Unity's nested prefab system working just like Adobe Flash's Symbols (their version of prefabs). Double-clicking a Symbol in the scene would open a Symbol editor where your changes propagated to all other copies. Of course, you could dive into its nested Symbols ad infinitum and make edits there too. Consider copying this system :)
     
    neoshaman likes this.
  40. Murgilod

    Murgilod

    Joined:
    Nov 12, 2013
    Posts:
    5,762
    From all the descriptions I've read, that's exactly how it works.
     
  41. eobet

    eobet

    Joined:
    May 2, 2014
    Posts:
    176
    Damn, I missed this thread all this time, and now even with nested prefabs, I'm being told that they won't solve this problem:

    https://forum.unity.com/threads/updating-prefabs-when-its-source-mesh-has-changed.318201/

    Also, Unreal's Blueprints are interesting in that they open a new window for exclusive editing of just that Blueprint, similar to what Unity does for rigging imported FBX files... but I've never seen that happen for anything else...
     
    joshcamas likes this.
  42. verybinary

    verybinary

    Joined:
    Sep 23, 2015
    Posts:
    373
    My (quite possibly "very isolated") case is to have 1 prefab per scene. everything in the scene is in that prefab.
    Why? I have an app that I demand to be cross platform(not demand from you, but demand from me). I had, in my first setup, multiple project files, each with a complete build setup(input manager, editor options, build platform set(I also tried switching over on the fly, but took way too long to recompile assets or whatever for each, this also didn't switch over the input manager definitions, and each build needed different input settings(mostly for mouse clicks and the lack of, on mobile)))
    one project had complete individual prefabs(level, lights, managers, etc) everything was kept in one folder except for assets and plugins. The rest of the folders were platform specific(VR sdk and joystick asset for mobile, steam in the pc project) and what I was hoping for was to edit the game once, copy the myassets folder over to each of the other builds and then build them all, one after the other with a complete everything built around the myassets folder that contained meshes, prefabs, scenes etc.
    Yes, I know its a complicated setup, but mainly, the input manager needs a different setup for "each". The mobile will always preform actions with a controller, or touch screen, and inputs conflict with the PC version. I want everything to stay automagical for the user, so I have different project setups, including the input manager.
    What I did was transfer the myassets folder, and opened a scene from that folder, and saw bunch of red named "broken prefab link" or something. so everything went into "one" prefab(I say one because im kind of cheating with the description, I have another prefab called "allscenes" for everything that stays consistent for each, like an interaction manager.) now, all I have to do when I switch to a different platform, is open the scene, delete the broken prefab, and drag in the scene prefab.
    Im excited about the nested prefabs because I would theoretically get to drag that one in, and if anything needs edited, I can single out a prefab. All this is including a similar problem to eobet that they are certain this wont fix. I can put a mesh in a prefab, put the prefab in the scene, put everything in the scene prefab, and if the level changes, I update the mesh prefab with the new mesh and the scene is updated. But whatever. I don't care if he/she understands it.
    I don't even know if you still care about input on the matter, but the post is still up, and I noticed it again...
    But don't mind me. Keep at it. nested prefabs will make me want to update past 5.6
     
  43. RobsonCozendey

    RobsonCozendey

    Joined:
    Oct 19, 2013
    Posts:
    69
    Something that I miss is the option to save baked lighting in the prefab. In some genres, like autorunners, instantiated scenery is the natural path.

    It is understandable that, as default, it is not possible, as baked lightning deals with global illumination, and hence always depends on the particular vicinity of each instance, but it could be an option, at least, even if with a warning.

    I faced this problem when making an autorunner using GI. The workaround was to bake several instances in a circle to get identical lighting (a few hours of baking), let everything dynamic, except mark "lightmap static" and "reflection probe static", and pool them:

     
    Martin_H likes this.