Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

can I use subversion to manage my unity files?

Discussion in 'Formats & External Tools' started by Erin Liu, Mar 18, 2010.

  1. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    :D Hello everyone. I am a beginner of unity 3d. And I have a problem of file version management. I have known that unity Asset server can be used to manage the files of unity project.

    But, we have used subVersion to manage our files in our lab for a long time. Therefore, I would like to know if I can use subversion to manage my unity files?

    And, how can i use subversion to mange the assets files, project files and script files?

    Thanks for your answer and help. I really appreciate it.
     
  2. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    If you use pro SVN works well so long as you disable a couple of folders in your svn libraries.

    With the free version your stuck with something like dropbox as the version control options are disabled.
     
  3. Tom163

    Tom163

    Joined:
    Nov 30, 2007
    Posts:
    1,290
    With Pro, yes you can.

    But - my personal opinion - it's such a PITA that unless you are a masochist, you don't want to do it.

    For one, forget about renaming, moving or copying inside the Unity GUI. Won't get propagated to SVN.
     
  4. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    I think Dropbox works better since it will not stop the update if there is a conflict in your Unity project.
     
  5. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    moving, copying and renaming works ok here. Just make sure you go to "edit/Project settings/Editor" and that Version Control Support is enabled

    Just don't commit or set these folders to ignore

    \Library\metadata
    \Library\cache

    But do commit the Library root with all the editor settings and you should be fine.

    When you commit with ignore on, just commit the whole project folder, anything that was renamed or copied in the editor will show as missing. If you commit those then they are simply deleted and don't cause any problems.

    Wev'e been using Unity Pro with SVN for 3 weeks now using the above method with few problems.

    Originally we used dropbox but it was a pain. With SVN you can just use your SVN folder as your working folder and commit update when you want. With Drop box you have to be a lot more organized if your going to avoid conflicts, and of course there is no revision system for when things go wrong. So best to work from a seperate folder.
     
  6. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10

    Thank you so much!
     
  7. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    Thanks a lot
     
  8. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    for these none masochists, there is the asset server :)
     
  9. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    Thank you very much!
     
  10. codinghero

    codinghero

    Joined:
    Mar 21, 2009
    Posts:
    450
    Coincidentally I started thinking about a svn solution yesterday and am happy to say it works in the Indy/Free version. I've tested it with my teammate and with porting PC projects to iPhone and it definitely works. The only caveat is you must close the Unity editor before performing svn operations that will affect the Library.

    Assume you have a project named prj-1. The directory structure might look like this:
    Code (csharp):
    1. \prj-1
    2.     \assets
    3.         \models
    4.         \scripts
    5.         \textures
    6.     \library
    7.     \scenes
    8.  
    All directories and contents can be committed to svn EXCEPT for \library. You can either set \library to be ignored or just never commit it from the beginning. With the UT editor closed, zip up the \library directory and commit the zip file to svn. After doing any svn updates, unzip the library.zip and overwrite the existing library folder (i actually delete \library before unzipping). The first time you (or another team member) check-out the project you will need to manually open the scene file.

    Now that you've got the structure set up you can either A) work from the source controlled directories within the UT editor, or B) svn export the project to a separate directory for editing withing UT. With option B you can do frequent commits and updates without the need to close the UT editor provided you haven't made changes that will affect the Library (modifying assets, and most script changes are safe).
     
  11. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    Thank you so much! You are really helpful! I will try the method!
     
  12. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    Thank you so much! I will try it!
     
  13. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    Just as a side note to that: ensure to not work on the project in the dropbox itself. you will pretty fast realize that the attempt of dropbox to lock the files for upload and unitys perma write attempt fight each other that ugly that it will bomb, will lock or throw errors on impossibilities of writting and if anyone else works on the stuff at the same time you at worst trash the project completely as your side can only update some of the files the others will fail and when you save again, you get 2 completely incompatible sides that will go nuts.

    Already SVN has a few traps you can easily run into, the optimal solution is really the Asset Server (files never missed, you don't need to have the 3d tools installed as the cached import from the model is automatically present too etc)
     
  14. codinghero

    codinghero

    Joined:
    Mar 21, 2009
    Posts:
    450
    My teammate and I have been using the above mentioned svn process extensively for the past few days and we've had no problems. He does all the assets (models, textures, etc) and I am doing the code, so I don't have any 3D tools installed on my system. Not sure what you meant by that, dreamora.
     
  15. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    I think he means if you upload .max files from 3dsmax (or some other 3d app native equivalent) that haven't been compiled into .FBX yet.
     
  16. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    yeah. I think it works well as you said.
    However, we can not modify one unity project file at the same time by more than one person. I checked the problem. And someone said because the unity project file is binary file, it can not be modified by more than one person at the same time. I think the nonbinary file will be presented in the future!

    Thank you again for your help.
     
  17. Erin Liu

    Erin Liu

    Joined:
    Mar 18, 2010
    Posts:
    10
    I think so. the FBX. can not be changed so easily
     
  18. codinghero

    codinghero

    Joined:
    Mar 21, 2009
    Posts:
    450
    If that's indeed what he meant then it doesn't make much sense. The artist on my team knows what formats he needs to export to.

    @Erin, glad to hear it's working out for you. Yes, the fact that you can't do svn-merges is a pain, but it's the same with images, models, etc so keep that in mind. ;) Just make sure you follow good team practices and svn-update often.
     
  19. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    a lot of artists don't bother exporteing to anything but their native app format like .max because unity can read them and creates the fbx files for you if 3ds max is installed on the same computer your running unity from. Same with Maya, blender, C4d and a few others.

    It can cause problems if you don't commit everything, since the coder on the other end may not have those apps installed. Thats what I meant.

    Personally I prefer to just use fbx even if .max is convenient. With FBX you can be selective about what objects in a scene are exported and keep layers and working helpers that would make a mess if you exported everything.
     
  20. codinghero

    codinghero

    Joined:
    Mar 21, 2009
    Posts:
    450
    Heh, I hear you. I'm the same way. When I did the assets for my one-man-show games I exported to the proper formats too. There's just something icky about opening the project window in Unity and seeing a 25meg .psd file staring back at you. ;)
     
  21. 1john

    1john

    Joined:
    Mar 23, 2010
    Posts:
    9
    I dont think the Asset server is an option for most of us...
     
  22. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    The asset server is quite pricey assuming you have two people collaborating on a simple game project. Your looking at half the price of a Unity Pro License.

    I'm sure its great for established developers with a steady development income and can budget for it. Plus it looks like you need to have quite a fancy web host if you want to install it, unless you happen to have a super fast connection for a dedicated server at home.

    Subversion is free and hosting can be as little as $5 - $10 a month included with some popular web hosting packages like Dreamhost including Trac and other developer tools. Plus there are Dropbox alternatives with VCS support starting at less than $100 a year.

    So the Unity VCS costs a lot, I'd be interested if it was in the $100 range and had advantages over SVN but doubt I'll get to use it because most of my work is contract work, and so far no one I have worked for supported it.
     
  23. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    you can not host the asset server on a webhost, you need a dedicated machine actually
     
  24. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    I thought that was the case, though my web host lets me install some apps using a unix shell. So I thought I might be able to. Thanks for pointing that out since very few individuals have a dedicated server.
     
  25. 1john

    1john

    Joined:
    Mar 23, 2010
    Posts:
    9
    From what I understood, you basically save a library "state" and then keep it that way for the whole project, is that right?
    Isnt there any important information in that folder that might affect the project when you overwrite it with an older version? I mean, that folder exists basically to avoid people from using SVN in first place? o.0
     
  26. codinghero

    codinghero

    Joined:
    Mar 21, 2009
    Posts:
    450
    There are quite a few free svn hosting sites. You can just Bing "free svn host." Just be sure they have free AND private.

    What we're doing is committing Library states. So if I make changes to the project the new state would be saved to svn. My team can then svn-update and get the new state. Repeat ad nauseam.

    I got the idea from my iPhone development work-flow. I make the games on my PC then when they are ready to add iPhone specific stuff (controls, etc.) I just copy the whole thing to my Mac. I figured if it works that way it must work from user to user. Turned out I was right. ;)
     
  27. 1john

    1john

    Joined:
    Mar 23, 2010
    Posts:
    9
    I see. witty ;)

    Now on to another noob question: what types of changes do affect the library? And do you know what error should we expect in case we commit it without the zipped library (expecting there were no changes in it) when we were supposed to commit it as well?

    I started trying the solution you suggested, and solution B (not working on the versioned folder) seems a lot better, since A needs the editor to be closed and updating everything might take quite a while.
     
  28. codinghero

    codinghero

    Joined:
    Mar 21, 2009
    Posts:
    450
    I don't know every operation that will change it, but I'm pretty sure anything that would change the contents of the project (adding assets, changing import settings, etc). To be safe I would make sure you always commit it though. ;)

    Btw, we've been updating and committing since I posted and haven't run into any problems.
     
  29. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    if you have the free version you pretty much have to include everything. If your using the pro with version control, you can ignore everything but the files in the libraries root folder. Metadata and cache don't have to be committed.
     
  30. xabi

    xabi

    Joined:
    Apr 30, 2010
    Posts:
    7
    Well i tried this, but i 've got some differences, when loading everything from a computer to another.

    For example (i'm using the free version) when i'm loading my scene on the new computer, i must re-set the materials, textures, And some scripts.

    Any ideas?

    One is on Vista 32 and the Other on Seven 64 ;)
    Thanks.
     
  31. Nebulous

    Nebulous

    Joined:
    Jun 25, 2009
    Posts:
    6
    We were trying the unity asset server (with Unity Pro) before and just got around to trying subversion, and I had a couple of questions.

    It's OK to ignore Library\ScriptAssemblies right?

    Do you need to commit ALL of the files in the Library\ root? It looks like certain files like assetDatabase3 and MonoManager.asset may get modified just by loading a project and then quitting Unity. Did you have to deal with that?

    Is it a problem if you can't merge the .asset files in Library\? With the asset server, I know the .asset files in Library\ could be compared with something like TortiseMerge from the asset server window... I'm not sure if they could actually be merged, though.

    Thanks.
     
  32. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    For setup of SVN or any VCS, check out the manual - advanced topics - version control xxxx
     
  33. Cyclops

    Cyclops

    Joined:
    Jan 31, 2010
    Posts:
    111
    Have you considered using Subversion for partial coverage of your project? For instance, I use Subversion on my Blender .blend file (in a separate directory), and of course it works fine on my Script files.

    Because I'm a programmer, the projects I'm working on are more script- and model-based, so this gives me, if not complete coverage, at least most of the key pieces in Version Control. Even if I completely lost an application, re-creating the levels, etc, would be doable.

    Even if the majority of your work is in the Unity Editor and not storable in Version Control - store something. :) The more you can protect from loss, the less you have to re-create. Version Control is always worth it.

    Update: Something else you can do to increase coverage. Export a Unity .package that includes all of your Assets, Materials, Scripts, etc - basically everything except Standard Assets, and make a backup copy of the .package somewhere else on your harddrive. Note that you should not store it in Subversion. Since a .package is a binary file, Subversion would not be able to efficiently store it, and you'd have major size problems.

    This is a bit clumsy, but if you export every couple of days, say, it will at least save you from a total loss. You'd be able to re-create most of the project.

    John C>
    "For all your days, prepare, and meet them ever alike;
    When you are the anvil, bear - when the hammer, strike."
     
  34. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    You can ignore script assemblies folder.

    With the Library root files, I just commit them all, never bothered to check which ones could be ignored. I just have the child folders ignored by subversion. It's not a lot of data and so far we have had very few subversion problems with Unity. It works just like any other subversion project with other engines so long as your using pro.

    We try to avoid renaming subfolders in assets, if you have planned your project well and structured the assets properly from the start you shouldn't need to anyway.
     
  35. cquinones00

    cquinones00

    Joined:
    Aug 18, 2010
    Posts:
    7
    Hey, everyone. New guy here. :D

    I've been messing around with Unity for about a week and was just getting to researching how to version control our project and stumbled on to this.

    We can't really purchase the pro license so I'm trying to come up with a solution that allows us to work concurrently.

    So... codinghero's solution does not allow for concurrent scene editing, right?

    Not being able to merge scene files is going to be a huge problem. Any ideas on what approach to take?
     
  36. cquinones00

    cquinones00

    Joined:
    Aug 18, 2010
    Posts:
    7
    Bump? :?:
     
  37. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    there is no solution for concurrent scene editing, independent of what you use. Not even the asset server license would give you this possibility.

    if multiple users work on the same scene you must work with prefabs and only update prefabs between users with a single user being entitled to commit updates to the scene (for adding new prefabs etc)

    What also helps is if you don't use SVN but GIT instead if you are interested in concurrent changes and don't want to spend hours to weeks on merging collisions that come from the fact that SVN stores change sets not individual changes and thus can't chronologically reapply them on a merge (the local commit also helps with team members that not that regularly get to commit to the main server)

    Using git vs svn can be a pain but I've to say that smartGIT makes it as painless as using SVN if not even more painless (found out about it when I was looking for a usable crossplatform SVN where I got smartSVN in the end)
     
  38. cquinones00

    cquinones00

    Joined:
    Aug 18, 2010
    Posts:
    7
    Thanks for the reply, dreamora. Git is definitely on the radar for us. Thanks for suggesting smartGit. I've been looking for a way to get some of the designers and content guys on version control without forcing them to use Git on the command line. :D

    I've used Tortoise CVS and SVN as an alternative to the command line clients. Have you tried http://code.google.com/p/tortoisegit/? I'm going to give that a shot before I commit to purchasing anything.

    For now, it looks like I will be selectively versioning parts of the project and see how that goes. At the same time, we will probably designate one "scene master" that will be responsible for scene editing and committing those changes.

    Any other ideas are welcome. Thanks again for your help.
     
  39. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    I've used all 3 tortoise but tortoise is windows only which for me became a problem as I do iPhone development exclusively on osx and as my macbook pro is also my notebook, all work while traveling is done there too and I wanted to use the same application on both sides so I don't have to keep different workflows and various different tools for the merge etc in mind (on windows with tortoise its winmerge I use)

    tortoise git is nice, but by far the weakest of them, yet still solid enough for the base work :)


    Tortoise is just about the most designer and artist unfriendly tool normally right after the console ;)
     
  40. cquinones00

    cquinones00

    Joined:
    Aug 18, 2010
    Posts:
    7
    I agree with that, but I don't know if we have too many options at this point. I'm also running on OS X, so I will mainly be dealing with a terminal most of the time. Some of us are on Windows machines so I figured I would recommend TortoiseGit to those that are afraid of command lines.

    I just found this:
    http://gitx.frim.nl/seeit.html

    It may be a nice GUI alternative for those of us on OS X.
     
  41. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    tortoise is fine for artists so long as they use the context menus for tortoise to delete and add files and don't use explorer for file management. Renaming folders can cause problems but otherwise once set up SVN with tortoise is pretty straight forward.

    Of course there are always artists that have no clue once things get even slightly techie but they tend to be a minority if they have experience.
     
  42. Emon

    Emon

    Joined:
    Aug 27, 2010
    Posts:
    35
    Has anyone tried using Bazaar for version control with Unity? It supports a flexible workflow (distributed or centralized), locking (useful for binary assets!) and (according to some) may be more friendly to unmanaged add/delete operations on files. The only downside is that Bazaar is usually thought of as being on the slow side compared to Mercurial or Git... however, pushing any large assets over the network should really be bandwidth limited. It might be a problem with a ton of small files, however.

    I'm gonna give it a shot and make a thread about it if it works out.
     
  43. Kathrin-Jennifer

    Kathrin-Jennifer

    Joined:
    Mar 29, 2010
    Posts:
    128
    I'm using SVN and I continiously have the problem that some scripts, materials or meshes are missing when updating the project on a different workstation. Is this really an SVN problem? Does someone has a solution for this problem?
     
  44. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    thats neither an svn nor a unity problem
    thats just the user that did not add the files ...

    I switched to smartSVN as it is acapable of detecting moves which are normally an ugly pain in the but and also detects removes and adds, which removes all the common problems with commit inconsistencies etc
     
  45. Kathrin-Jennifer

    Kathrin-Jennifer

    Joined:
    Mar 29, 2010
    Posts:
    128
    Thats not the user. We set up a project and commit it to svn. When updating the project at another workstation there are sometimes some scripts, materials,... "missing" even if they haven't been altered. This happens only sometimes but we haven't found out yet why.
     
  46. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    did you follow the documentation on VCS support in unity especially on which files you must not commit?
    cause if you commit the files in the library folder you were not meant to, it will mess up pretty ugly. (similar problems naturally as well if you forget to add the meta files)
     
  47. Kathrin-Jennifer

    Kathrin-Jennifer

    Joined:
    Mar 29, 2010
    Posts:
    128
    I don't commit any files from the library folder, but the empty folder.
     
  48. Tysoe

    Tysoe

    Joined:
    Jul 6, 2009
    Posts:
    577
    You do need the files in the library folders root as those are project and editor settings which set up your game project and ensure all developers get the same settings and compile settings.

    All the sub dirs should be ignored. If your using something like Subversion there's an option to ignore folders in the right click context menus making it really easy.
     
  49. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,601
    manual - advanced topics - versioning xxxx

    contains a full list of which folders and files to ignore.
    there are important files that must be ignored from the library or it will blow up on each update at worst
     
  50. tm

    tm

    Joined:
    Aug 2, 2010
    Posts:
    63
    Unfortunately, no. Not if you want to have reusable code outside project scope. Not that SVN does that particularly well. Unity just seems to hate the idea of having code used outside project scope.

    None of this would be an issue if you could just configure the damn unity editor and tell it where to find the Plugins and Editor folders. But we can't, and we're left having to pay $300 for something that handles a problem that's solved by free software with none of the include / library functionality of a normal editing environment (and we don't even get merge or diff for the unity stuff! or locking on anything! seriously!).

    I've been trying to avoid this until our next project rolled around. For a little while I thought there might be some reasonable workarounds. None of them seem to work for us without writing our own rcs hook layers. Layers that apparently will have to be pretty complicated.

    I have to say, revision control, reusable code, and similar in unity is a complete, awe-inspiring disaster the likes of which I have never before seen. The scale of the disaster is truly something like having the planet catapulted into the sun for the crime of thinking about employing rational best-practices.
     
    Last edited: Dec 7, 2010