|
I'm using mostly GIT, but I believe this doesn't depend on which one you're using, even if it's Asset Server. And this is really not a big issue, but it's a pain. Keep in mind I'm following everything in the manual plus what I've found. Plus, in the last library rebuild, it bricked something on our lightmapping that I had to re-do. Nothing big, but all this makes me scared of getting bigger. There are many things that will trigger a complete library rebuild, which can take over 10 minutes to complete:
The question is in the title: How to prevent the library to keep rebuilding itself like that? Would it work if I version it along, at least with the major versions? Is there something I'm missing? I do realize next Unity will bring a "Library Network Cache", but that should solve just 1 of those listed items. edit / update: Actually this became a bigger problem already. I'm not fully using git thanks to it. Can't really go back in history to an old commit or different branch and test stuff as I'd like to. The 10 minutes rebuild, which was already too much, became over 1 hour. Maybe 30 minutes when Cache Server decide to work, in a best case scenario. Some times we need to go through, tho. And it sucks very hard. So, still missing a good solution here, despite the accepted answer!
(comments are locked)
|
|
Summary: don't let your version control system rewrite history or re-perform changes that were previously made. Unity will always reimport assets if their timestamp changes. If you want to make a backup of your project to in case of accidental re-imports, you must copy all folders as well as timestamps. Windows/OSX copy functionality does not preserve timestamps, so you will need to use a helper application. (In OSX terminal or Cygwin, "cp -a" does the trick.) When you check out on a new machine, the build platform isn't specified because you haven't checked that file in. Do it and you'll never have this problem. To find out where the platform build settings are stored, make a small project, change the build platform, and see which files changes. It's in Library/ or ProjectSettings/. Here's a trick about using Git and avoiding reimports: Always keep a project backup (and backup when in a state where Unity doesn't need to re-import anything). If you do some Git operations (like svn dcommit or rebase) and your file tree ends up mostly the same as it was before besides that the modification times have changed, you can salvage the situation: use a syncing program like rsync to copy your whole project backup (except the .git folder) over your main project, deleting any differences (rsync -a --delete). At this moment, your recent changes will not be reflected in the working copy, so use "git checkout" and maybe "git clean" to iron out the differences. Now when Unity is opened, it will only re-import the files that are actually different, regardless of any changes that may have been done and undone. Also, if you must rename an asset, do it within Unity and not the filesystem. That way Unity knows it doesn't need to re-import. (Your coworkers will still need to re-import that file/folder, so do this sparingly.) All seems very reasonable, but unpractical. I don't think we can implement any of those tricks into our procedures. The whole point of using a versioning system is so we don't have to manually handle it all, as you're suggesting. Because it's so much work to do without it, that we just don't do it. Have you worked in a big project and applied any of those hints? Despite it all, it is the best answer so far ( out of 2 :P ) with some good insights on how it works (though I haven't tested). I think it still doesn't answer the question at all, tho.
Jun 04 at 11:25 AM
Cawas
Keep in mind Unity was created before distributed VCS became really popular. Unity assumes you're not going to locally commit and uncommit and recommit your changes. Unity thinks that when you change a file, you're gonna change it once. Until recently, rebase-like operations were rare and usually done by hand. If you use version control for simple operations, Unity will not do unnecessary reimports. Want to fix the root of the problem for you and everybody else? Patch Git so it stores timestamps before a rebase and restores the timestamps afterwards if the file is the same as the old version (if the operation involved undoing/redoing changes). And I do use the tricks I mentioned. It's not convenient, but it's not slow or overly confusing, given that I understand the issues at work. Furthermore, I consider it utterly necessary, given that a full reimport would waste at least half my work day. A less complex trick: don't use git svn, git rebase, or git reset.
Jun 04 at 11:33 AM
lh
I'm not asking how it works or why it doesn't work. I just want to "prevent library to keep rebuilding itself with external version control". I would try and patch git so it would store timestamps, if it can be done (no idea if you mean using some trick or actually getting the git source code and hacking into it) and if it would really solve the issue. As for you're really using those tricks, I may not be reading it right. How big (in bytes) is your project? Are you using mostly git? In what situation you do those manual backups? How many people involved? I really can't see how going through all this problem would be any advantage to waiting the library to rebuild. The problem isn't only about wasting half the work day. This can easily sum up to a whole work day or weeks. And how much extra work we do trying to avoid that - so it's already taking a lot of time anyway!
Jun 04 at 11:53 AM
Cawas
The serious and simple answer is to not rewrite history. Don't use Git as an svn frontend, and don't use its history-rewriting features. I use these tricks and more complex ones, but my coworkers don't. I'm helping one other programmer back up his working copy with scripts, but I think for the others, it's more trouble than it's worth. And the repo is SVN (>4GB), but I'm using git-svn as a frontend.
Jun 04 at 12:11 PM
lh
You should add that as your main point on your answer. I agree. Simple and only true unfortunate answer so far is indeed "do not rewrite history". Because Unity can't really handle it. Be it for timestamps or external renames, it's really poor at it, as you said. For reference, we are using only git (no svn hassle) and just the working dir is already at 12gb. 45gb if you count
Jun 04 at 12:22 PM
Cawas
(comments are locked)
|
|
It seems Unity 3.5 no longer supports files that begin with a period (a ".") so a filename such as ".somefile.prefab" will cause Unity some to have some issues. The fix for this is to rename your file so that it no longer begins with a period. Specifically I was having this problem with 2D Toolkit which creates a file called ".tk2d.prefab". Renaming this file to "-tk2d.prefab" and fixing up the tk2d codebase so that it loaded this file instead resolved the issue for me. This sounds like a nice tip... But far from an actual answer. Which "resolved issue" are you talking about? It's certainly not the same as I pointed in the question.
Jan 26 '12 at 12:23 PM
Cawas
(comments are locked)
|

I'm getting a very similar issue with 3.5b6. Just upgraded from 3.4 today and now about every 5-10 mins this popup (http://imgur.com/SrNGU) appears for about 30-60 seconds. It's very frustrating.
I noticed the console contained the error message "Rebuilding library because the asset database could not be found!"
Plus if you want just the Library Network Cache it will cost you the whole $500 from Asset Server because it's bound to it.
At my company of we tried using subversion with unity project folders and it never did work. We ended up checking in .zip's of the project rather than the project folder. This defeats the purpose of having multiple people work on and commit files but it did save us from corruption.
Don't know if thats an option for ya!
T
@Tyler we're using GIT and keeping separate pre-compiled library folders in each machine. Kind of what you're doing, except the commit is there and there's no corruption. Still this doesn't work for using old commits neither moving folders. It only works for new machines and tags and labels - or as much as we want to manually keep track of library folders while each machine's hard disk also needs to have room.
Hmm, well, I know if you are checking in your Assets folder - but not the Library folder, you will need to rebuild the library database each time you open it. At least I think, I am not a pro or anything :D. I know that if you change the name of a file in code and then give that Assets folder to someone else it will have to rebuild the Library folder on that persons computer. Name changing is such a pain haha. Even in Flash Builder projects similar stuff happens. I moved to checkin in .zips of the whole actionscript project too because of similar issues. Ill watch this thread and see if you figure it out.