- Home /
What is saved in the Game file when completed
Please dont be overly technical. Im still learning,
I am just learning Unity and thought I'd try something simple. I created a small village. No people. No actions. No combat. Just a walk around. When I save the file for someone else to look at, is this file going to be filled with extra code and files that arent being used? If so, is there a way to NOT have that happen?
When you say "save the file for someone else to look at", do you mean them looking at the source files and scene in your Unity project? Or do you mean letting them play a compiled version of the game?
If it is the former, then my answer applies; however, if it's the latter then when building a compiled version of the game, Unity uses reference checking to automatically trim unused files from the resource files the build process generates. Your code will still be visible by anyone using a .NET decompiler, like ILSpy, but they won't get context on how the files are used. You may consider Obfuscation tools if you don't want others using your code.
It's generally agreed that obfuscation tools have little benefit - they certainly make debugging any problems found during development much harder, and they have quite significant risk of breaking callbacks that are referenced by name. You're generally correct about Unity only including assets that are referenced within the included scenes in a build - with the exception of any assets placed in the /resources folder, which are included regardless of whether they are used or not.
I am referring to when I compile a game. Im hoping that if I build something simple, that the compiled game isnt huge due to extraneous libraries and code that I didnt use.
No, it won't be. Assu$$anonymous$$g you haven't placed any resources from the /resources folder, the only assets included in the build will be those models, textures, animations and sounds actually used in the included scenes. (you can check this by exa$$anonymous$$ing the editor log after making a build - it will show you exactly what assets were included).
Answer by Vicarian · Apr 25, 2017 at 08:00 PM
Generally, when you deploy (distribute) a Unity project, you may omit the Libraries folder and the Visual Studio solution (*.sln) file. This folder and associated Visual Studio files are rebuilt automatically on loading Unity. A good way to distribute a full Unity project is to package it using Assets > Export Package... then select all your files in the window that appears. Unity will generate an archive for you with all your files for someone to then import into a new project.
Your answer
Follow this Question
Related Questions
Moving file failed 2 Answers
Hide certain game files? 1 Answer
Unity 5 _ Game freezes on play when any script is added to the project. 0 Answers
Unity3D crash after launching. 0 Answers