Show what you've made with the improved Prefabs features! Write a bit about what you did with the new features that you couldn't easily do before.
Really optimized nested and variants prefabs memory. 70kb instead of 600kb+ in previous unity versions. Good job Unity team. Keep testing
Well, we are just as surprised as you. There should be no difference in performance at runtime since all Prefabs are baked out into hierarchies of regular GameObjects. None of all the new Prefab features exist at runtime; only in the Editor.
That means you didn't change any prefab architecture under the hood? I've read something about bad design decisions in prefabs, can you tell: is that true or you have no plans on improving prefabs under the hood?
I'm not talking about RAM optimization. I'm talking about build size, very important for mobile. For example, in previous versions of Unity if you have 5 prefabs with just different materials they could be 60kb for each. But if you now create one original prefab and 4 variants of the original. It could be 60kb for original and 3-5kb for everyone else. Great optimization if you have hundreds of prefabs like that Head Bot - original prefab Head Bot Variant 1 - the variant of original prefab with changed materials and transforms Cluster - original prefabs which exist from 9 Head Bots and 9 Head Bot Variants Cluster Variant 1 - original cluster but with few changes In previous unity version if create something like that structure the general size of prefabs could be 600kb + For example, Head Bot (17kb), Head Bot Variant (17kb), Cluster (17 * 9 * 2 = 306kb) Cluster Variant (306kb). And we have 17 + 17 + 306 + 306 = 901kb if using previous Unity version prefabs. I guess unity zips it in build with the lower price, but one deal is zip 901kb and another one zip 60kb
.prefab extension are editor files. Rune explained that the prefabs get flattened at build time so I don't expect much improvement. What's your size delta on the builds?
Prefabs before existed only in the Editor, not at Runtime, and that is still the case now as well. We did change Prefabs under the hood a lot, but it has no effect on runtime since there's no concept of Prefabs at runtime. You can "instantiate Prefabs" at runtime, but you're really just loading and duplicating baked out GameObject hierarchies, unlike instantiating Prefabs in the Editor, where you get a proper Prefab instance that can have overrides etc. You can see the same in Play Mode, where when you instantiate a Prefab as part of your game, it will look like regular GameObjects and by default have "(Clone)" appended to the name.
I'm making a city building game. Now I can have a base building to act as a template, then just modify the mesh/collision gameobjects for each variant, and add new MonoBehaviours. Also, the same for different types of NPC's. Maybe I can go even further and make a base "Placeable" prefab template, then "BuildingBase" is a variant of that, then the actual visible buildings are variants of BuildingBase... Each building would be a variant of a variant. I haven't tested that. There are three things Unity made recently that made this game easier to make - Runtime NavMesh, GPU Instancing and now Prefabs.
For those who haven't yet seen the Unite LA 2018 keynote, Joachim Ante and Martin Kümmel showed off Unity's new MegaCity demo which makes heavy use of nested Prefabs, Prefab Variants, and the new Prefab workflows (along with all the new ECS features!) to create a massive city in a very short amount of time by just a couple of people. Here's a link to the keynote beginning from where this is shown:
The demo itself is impressive but it only shows a subset of how artists use prefabs, which in this case is moving objects around, and because that subset is limited the demonstration doesn't show the shortcomings of the new prefab workflow.
Yes, that applies to every demo, ever. For a flexible toolset, no demo could ever show every possible way it can be used. This thread is for showcasing various examples of ways that the Prefabs are being used.
Not Bitter, empassionate - about having this cornerstone ironed out to perfection because I'll be living with them for the next 5 years.
Hi all. I've been using Unity in both a hobbyist and professional capacity for about seven years now, and I cannot fully express how much I love the new prefab workflow. I've been one of those rabid "why don't we have nested prefabs?" guys since I first installed Unity... When I installed the new alpha preview, I almost felt like I could cry. It's beautiful. It's completely changed the way I approach almost every element in my games, and being able to treat objects more like object-oriented programming (with inheritance and such) is an absolute godsend. Yes it has bugs, yes it's a little clunky, yes it has a little bit of a learning curve... but overall, it unlocks potential in Unity unlike any other update I've seen you guys put out. (And I've already seen it improved tenfold with the .1.0a8 patch; I'm sure by the official release it will be more or less rock-solid.) Anyways, big thanks to the Unity devs for the hard work and for listening to us (and for the community for making noise!) From myself and my protagonists--you all rock!
I fully support the new nested prefabs feature. It will be an awesome tool and will greatly improve Unity's workflow in most cases. However, in some cases it is best to generate prefabs w/ scripts (not drag & drop). In this case the new prefab system is breaking my prefab workflow. Currently I use an editor script to generate all prefabs (this makes new prefabs from scratch then I call CreatePrefab or ReplacePrefab). I do this because I have many prefabs with complex hierarchies and subtle differences (slight variations in size, or texture, or scripts, or rigidobdy, or colliders, etc.). A drag & drop nested hierarchy will not work well because many of these differences are placed throughout the hierarchy. See video below. After creating my prefabs I use PrefabUtility.CreatePrefab or PrefabUtility.ReplacePrefab w/ ReplacePrefabOptions.ReplaceNameBased. The PrefabUtility.ReplacePrefab w/ ReplacePrefabOptions.ReplaceNameBased feature works great because it maintains my serialized scene links. The removal of ReplaceNameBased has me extremely worried. I tested the new PrefabUtility.SaveAsPrefabAsset and it breaks all serialized scene links. For those of us that generate & adjust prefabs w/ scripts what is the new alternative to the now obsolete PrefabUtility.ReplacePrefab w/ ReplacePrefabOptions.ReplaceNameBased? Is it possible to add ReplaceNameBased option into the new PrefabUtility.SaveAsPrefabAsset (or something similar like giving control over the serialized ID's foreach object/script in the prefab) so serialized scene links aren't broken when a new prefab is saved? Thanks in advance. You can see how the script generated monster prefabs in operation here.