Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Questions related to assets, builds and repositories

Discussion in 'Assets and Asset Store' started by arkasth, May 18, 2023.

  1. arkasth

    arkasth

    Joined:
    Nov 9, 2022
    Posts:
    9
    Hi!
    I have some questions about assets, hope you people can help me.

    1- Will all assets be included in builds? How can i tell if an asset will be included in a build? I'm talking about "tools assets", stuff that changes the editor mostly Graphical, sound, or game mechanic assets will be included in builds, right? I want to know that so i can remove these assets from builds if needed.

    2- About git repositories, i know i can't commit paid assets to public repositories, so i will need to ignore them during a commit. Can i just ignore the folder of an asset in gitignore? I can just import an asset to see in what folder it will be extracted, but how can i know if an asset creates any other folder during use (like, config files outside their main folder)?

    Thank you all!
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,019
    1. No. Only referenced assets. Ie if you only put an empty scene in the list of scenes in Build Settings you will have little to no assets in your build. Check the editor.log for a build report. There are also tools on the store, Asset Hunter is quite popular.

    2. Double no. No, you can‘t publicize purchased assets. But also no to excluding assets that are in your project. This will most likely break the project since assets not included in the repository will lose any references to them when pulling the project, and even when manually adding the asset back in place. Just make your repository private and share it with select people. But keep in mind that asset store assets shared with team members means you have to buy one license per person working in/with the project.
     
    arkasth likes this.
  3. arkasth

    arkasth

    Joined:
    Nov 9, 2022
    Posts:
    9
    Thank you for your answer!

    So, just to clarify...
    1 - If i'm using an asset that's not referenced, will it not be included in builds?
    2 - You said, if i have referenced assets and i ignore them when committing, i'm mostly likely to have problems. Even if i'm using, let's say, the Asset Hunter you mentioned, i can't just ignore the folder in gitignore and import it again if i ever need to clone the repo?

    I'm a solo dev, so i'm good about the licensing question.

    Thanks!
     
  4. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    4,019
    1) Yes, only referenced assets are in a build, with the exception of any files in StreamingAssets or Resources folders which always get copied into the build.

    2) When you reference an assets that‘s not in the repository and the reference is not through strings (ie path to assets - not recommended!) then you WILL have missing references in all cloned versions of the project besides the one where you assigned the reference. These references are made through asset GUIDs and those are stored in each asset‘s .meta file. And every instance of Unity will assign a unique GUID to an asset that doesn‘t yet have a .meta file.

    Now before you start thinking about only committing .meta files: don‘t do that either! If at any one point someone pulls that project and there is a .meta but the corresponding asset file isn‘t yet in that project, then Unity will delete that .meta file and the user may check in this deletion, thus you end up having the same issue but will only notice that when someone with a working project pulls these deletions and loses all references.

    Just keep your github repo private. It doesn‘t cost anything anymore in case you weren‘t aware. ;)
     
  5. arkasth

    arkasth

    Joined:
    Nov 9, 2022
    Posts:
    9
    Since your first answer, I've been reading about all this stuff.
    I think i'm going to keep my repos private then, just like you advised me. The main reason for me to keep it public was to be able to share my code as part of a portfolio, although i don't think anyone would compile the code to check the game. Maybe i'll just host web versions of the games somewhere and share.

    Thank you for your time and answers!