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

Ignore Resource folder on build

Discussion in 'Unity Build Automation' started by jeff_unity547, Jan 9, 2020.

  1. jeff_unity547

    jeff_unity547

    Joined:
    Aug 2, 2019
    Posts:
    9
    I am wondering is there anyway to not have the resource folder build. I am wanting to use it to load things during automated tests but I do not want those assets to make to my builds. It looks like there is some pre/post build things that you can do but I didn't know if those correlated to removing the resources from the build.

    Thanks for any help!
     
  2. lloydv

    lloydv

    Joined:
    Sep 15, 2015
    Posts:
    55
    Cloud build allows you to specify a shell script to execute pre and post build, so you could write a pre-build script that deletes your Resources folder(s). This should work because Unity does a fresh checkout every time and doesn't commit anything back to your repo.

    Edit: However, I'm not sure whether the script runs before or after tests. If it runs after and you have a shell script that deletes the resources, your tests will always fail. (Assuming you are running your tests on UCB)
     
    jeff_unity547 likes this.
  3. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,083
    Not sure if this is helpful for you but if you have an Assets\Editor\Resources folder you can load resources from the editor (and maybe tests?) but they won't get included in any builds.

    As @lloydv mentioned, you can also copy resources in the build steps. That's what I do to allow different resources on each platform.
     
    jeff_unity547 likes this.
  4. jeff_unity547

    jeff_unity547

    Joined:
    Aug 2, 2019
    Posts:
    9
    I was wondering what the build process was and how the check in/out for the pre/post builds. I can try it and find out! Thanks for letting me know about the build sequence that helps me make a decision. I can try it out this weekend
     
    LaurieAnnis likes this.
  5. jeff_unity547

    jeff_unity547

    Joined:
    Aug 2, 2019
    Posts:
    9
    I think this might be the best solution for me. I am assuming as long as this is checked in then cloud build will see it, run the tests in it's editor and then these resources wouldn't be included in the build. Do you access the objects by path or is there a shortcut to those resources that I am not aware of?
     
  6. tonemcbride

    tonemcbride

    Joined:
    Sep 7, 2010
    Posts:
    1,083