Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Grasshorse · Oct 04, 2011 at 09:22 PM · assetorganizationreuse

Best Methods for Asset and Code Reuse and Organization

Hello,

I was wondering if anyone had any opinions on organization of assets and code that would be reused over several projects, that may or may not relate to each other. Hypothetically speaking if I wrote a script that would perform a generic reusable function, that could be used by two different games, how is that code best managed.

  1. Is it better to build two different Unity projects and copy and paste that code into the two different projects from a "source" location?

  2. Is it better to build one Unity project where both of the games are developed and have access to shared resources.

The first method I see as easier to conceive, but would require diligent updating of code. May not be a problem for 2 games, but scale that to 6 games and that's a problem.

The second sounds like a much better code management model, being that code can be update once, and it will populate to all the other applications. This coding method seems like it may be much harder for developers to keep their head wrapped around, and also may mean that code specific to one game, ends up in another when it is not necessary. I also wonder about potential limitations multiple games in the same project, the ability to be built independently.

I'm sure there are other methods for production. I would love to hear anyone's ideas and opinions about the subject.

Best Regards,

Stephen.

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by jahroy · Oct 12, 2011 at 05:37 AM

One method that was discussed at Unite is to have a separate project for your code and to compile re-usable code into DLLs (using Visual Studio or MonoDevelop) that can be linked to from other projects.

If you have a lot of questions like this I would recommend attending Unite... it's basically 3 days of presentations about how different teams have approached issues like this.

The guys from Schell Games did an awesome presentation about their approach. They shared their slides here (I hope they don't mind me sharing the link):

http://unite.schellgames.com/
Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Grasshorse · Oct 12, 2011 at 03:29 PM 0
Share

Super awesome. Thank you very much jahroy.

avatar image jhocking · Mar 19, 2013 at 05:16 PM 0
Share

Here's the presentation those slides come from http://video.unity3d.com/video/3708530/unite-11-scaleable-game

avatar image
0

Answer by Grasshorse · Oct 12, 2011 at 03:19 AM

I'll answer my own question since after more thought, I determined my own answer. This isn't for me as much as other people that might wonder about this. It isn't possible to have multiple mechanics occupy the same project, ie. #2 above. If you are creating an app that you want to be "skinnable", and leverages the same mechanic it is possible to have variables, that can inform the code which "skin" to use. Other than that, it isn't possible for two games that have diverging mechanics to share a code repository. The Assets folder seems only able to be used by one project. So as a result, the scripts that could benefit both mechanics will have to be copied and pasted from the Assets folder of one project to the other. The other big gotcha prohibiting this workflow is that it appears that the build will only allow for one set of files to be specified. So if the build list changes in any significant way, it would require significant alterations that would mitigate and benefit to having shared resources. I am interested in hearing anyone else take on this issue.

Best,

Stephen

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image jahroy · Mar 19, 2013 at 06:48 PM 1
Share

It is certainly feasible to re-use code libraries by compiling them into DLLs. Large $$anonymous$$ms developing sophisticated games aren't copying and pasting code from project to project.

avatar image
0

Answer by srivello · Jul 03, 2013 at 04:30 PM

I like your organization of folders.

In general we, open a new project and import any Unity Technologies package and the only folder organization enforced is an 'Assets' folder with a subfolder of 'Standard Assets'. What about our custom assets?

Here is the SOLUTION. What Unity Folder Structure Do You Use? - http://bit.ly/1b7cLyq

-Sam!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to go about making and organizing scripts that you only use once. 0 Answers

How should I organize a project for asset store submission? 2 Answers

Should a HealthPack script add HP to my Player object or should the Player script add health to itself on collision? 0 Answers

Cant add bullet trail material to script - > Bullet Trail Prefeb 0 Answers

How much is downloaded from addressable groups? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges