I have a pretty large prefab in my scene, it has maybe 100 children all in all. I decided to make a prefab variant of it where i change the color of a handful of renderers. Now, every time i exit play mode, i get about 10-15 seconds of loading bars appearing regarding this prefab variant. It may not sound like much, but it gets annoying if you tend to jump in and out of play mode a lot. What’s worse though, is that every time i edit anything in the original prefab (in the prefab editor), the editor locks up and shows a loading circle for a split second, presumably to instantly refresh the variant. I can’t tell if it’s actually related though, since the editor has always been rather unresponsive, most annoyingly it tends to randomly zoom or snap your view to certain positions as you move the camera around. Combined, these things will completely throw off all sense of precision while working.
I have an Intel i7 processor with a GeForce 1080ti GPU, as well as an SSD drive, so i really don’t expect the editor to be this sluggish.
It’s not just that… literally every time i save ANY asset, such as a scene, or create a material, i get the “Hold On” prompt appearing, mentioning the name of my prefab variant, even when it’s not part of the scene i’m working on. It’s ridiculous.
As for the “auto save” option - i would prefer it if unity auto-saved whenever i left the prefab editor instead, right now i think it prompts you to save whenever you exit if it’s not turned off.
Unity needs to do work for every Prefab instance in the scene when the Prefab is saved in order to merge changes to the Prefab into the scene instances. Unity also needs to reimport all Prefabs that depend on the saved Prefab due to being Variants of it or containing it nested inside. Each of those also need to be merged for each instance in the scene of those.
Unless your Prefab is absolutely huge in terms of number of GamObjects and components, 5-10 seconds sound excessive if you have only 10 instances in total, and don’t have other Prefabs depending on it that are themselves huge or appear many more times in the scene. If that’s the case, feel free to file a bug report so we can look into why it’s so slow.
Also, note that there has been various performance improvements in later versions of 2018.3, so if you’re not using the latest, try to do that and see if it helps.
I am using 2018.3.5, and i only have a single instance in my scene - yet i have at least 10 seconds of loading screens popping in and out, even if the prefab variant is not even in the scene i have open.
All this would be well and good if the system actually worked. I just found that after building the project, the prefab variant AND the original got completely fucked up and some of their nested prefabs moved to random locations. Some of the changes i made to my variant were also lost, overall maybe 2 days of work. Screw this.
I can’t share my scene (in part because the project is large, and also i am not allowed to share it), and i’m not sure how to reproduce it without it. Should i submit a bug report anyway?
If you’re not sure how to reproduce it without it, then we likely won’t be able to either I’m afraid. We’d love to look into this issue but the reality is just that we need repros in order to be able to…
Sounds like you’re modifying the prefab asset in your project folder during play mode. You should never modify a prefab asset during play mode because it will permanently alter (aka f*** up) that prefab asset and therefore all instances and variants based on it! You will also get issues when you build the project since prefabs can’t be modified in builds. So make sure you’re only modifying prefab instances loaded at run-time and not the prefab assets themselves in your project folder!!
Placement in the scene doesn’t matter because you’re updating the prefab assets in the project folder. I’m also beginning to think that maybe prefab variants aren’t what you actually need… Maybe you only need to override the prefab instances in your scene. This works exactly the same as variants. Only difference is variants can be reused between scenes.
I think this is a great idea. Updating all prefabs whenever you make a tiny change to one of them can be really annoying, but having to confirm you want to save changes on close can be equally annoying. So I think adding a new toggle next to Auto Save called “Save On Close” that auto saves only when you close the prefab editor would be a really nice quality of life enhancement.
We don’t use the forum for tracking bugs and your steps of “Make a large prefab with about a dozen top level, nested prefabs.” is a bit ambiguous to say the least. We need exact steps, or a project that contains the described objects. Please post the case number here when you’ve submitted a bug report with repro project and repro steps.
What use is that if it gets us no closer to being able to fix the issue?
To be clear, keeping on talking about bugs in the forum but not submitting bug reports, even when we’ve made it clear we’ll need it to be able to investigate, only wastes time and doesn’t bring us closer to a solution.
I am not. There is no reference to this particular prefab anywhere in any of my scripts. It also doesn’t explain why i get this save dialog whenever i, say, create a new material - that just doesn’t make any sense at all and is incredibly annoying. Besides, this issue is much larger than that - for instance, prefabs which are placed in the scene root will sometimes tend to get their transforms reset as well. Just recently i had multiple instance of the same prefab have their transforms reset, so that they are all in the same spot (these were not variants, but regular prefabs).
Some components need to be respawned with their initial state, so i need prefabs for that. I just lost a bunch of work again though, so i kinda wonder if it isn’t just worth it to keep two separate prefabs and maintain them separately, or to solve it using nested prefabs.
Sometimes, discussing the nature of the bug is necessary in order to get enough information to post a bug report (since I’ve noticed that without exact reproduction steps, bug reports tend to be ignored). Many of us use Unity for a living, and we are not paid to reproduce bugs for you.
My comment was a reply to jrumps (as indicated with the quote) since he posted specifically in reply to my request for a bug report, and commented that “it’s pretty simple to make it happen.”. Well, it’s not simple for us, that’s why we’re asking for bug reports. If it’s already simple for someone to reproduce but still they won’t submit a bug report but rather just keeping posting about it, then it just doesn’t seem like a productive approach, but it’s their choice of course. It just won’t get anything fixed.
@runevision I’ve submitted a bug report with a project where this is 100% reproducible if you guys are still looking for examples of the issue: Case 1134356
On another note, i managed to find out some more about the issue with nested prefabs inside my variant losing their transforms. It seems to happen when i build, and it seems like lots of different prefabs get touched, even though i didn’t change them. Here is a git diff on one file:
What i happening for me is that (at least) 6 different objects are getting rotated and moved. Instances of the same prefab gets moved to the same spot - basically, the transforms will match whatever values the root transform stored in their prefab has.
By the way, is it legal to append new transforms to a prefab variant? I noticed that Unity complains if you try to change the order of them (which makes sense), but it is possible to add stuff to the bottom of the hierarchy. I’m wondering whether this is what is screwing things up, because after the first few times Unity screwed up the prefab, the two new objects have moved up the hierarchy (i have one prefab and one variant of that prefab both nested). Also, how about nesting a variant of one prefab inside a variant of another prefab?
That is bizarre. Where are you creating these assets and does it happen when creating anything or only certain types?
Can you elaborate on this? What do you mean by “Some components need to be respawned”? Are you completely sure you are not modifying components on the prefab itself?
This could be related to the previous quote if you are resetting transform components somewhere else.
@jrumps , what’s your Unity version? U can try latest 2018.3.8f1 at the time of writing and see your issue has been fixed or not. Looks like almost every week there is prefab bug fix.
Recompiling a script is a terribly slow way of tuning values and should be avoided. You should instead be editing an exposed value in the inspector. Using a ScriptableObject will also save changes made during play mode.