Skip to content

Instantly share code, notes, and snippets.

@andybak
Last active February 17, 2020 15:11
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andybak/f7573d2985aa6d1b905ed6519cb6a343 to your computer and use it in GitHub Desktop.
Save andybak/f7573d2985aa6d1b905ed6519cb6a343 to your computer and use it in GitHub Desktop.
A simple tidy workflow for handling external 3rd party code in Unity 2018
  1. Look on https://github.com/UnityAssetPackages to see if we've added the repo you want to use.
  2. Check if it's been updated reasonably recently. If not nag us to pull the upstream changes.
  3. If it doesn't have a fork on UnityAssetPackages then you can sumbit an issue and we'll add it, you can volunteer to join our org and do it yourself - or if you're in a hurry just fork it to your own Github (or Gitlab or whatever) account.
  4. Make a note of the url used to clone the repo.
  5. Run example.sh= in the root directory of your main project to add the submodule to your repo.
  6. Use the https form of each git url if you want people who don't have commit rights to be able to use your main repo
  7. Add a package.json to the external repo in the first directory you wish to include in your project (i.e. either Assets or a subdirectory of Assets) The example below shows you what to put in that file. The only really critical bit is the name - it needs to be unique to the project and match what you put in manifest.json next
  8. Add a line in the dependencies section of your main project's manifest.json file with the file path pointing to the directory containing package.json and the "com.blah.blah" the as the identifier in package.json. See below for an example.
  9. Remember to add a comma to the end of the previous line so the file remains valid json.

For free assets that are on the Unity Store but not in a public git repo - maybe email the author and ask nicely if they (or you) could create a repo for them.

It would also be useful to find out what the licence they intended their asset to be under - assuming if it doesn't already have one.


Footnotes about licences etc

I'd personally recommend releasing code under an MIT licence but some people might prefer something like LGPL

If it's mainly artwork instead of code then a open source licences aren't really a good match and you should consider a Creative Commons licence instead. CC0 or CC-BY are the most forgiving and most likely to encourage reuse. See https://creativecommons.org/share-your-work/public-domain/freeworks )

git submodule add https://github.com/UnityAssetPackages/UnityTimelineEvents.git Packages/UnityTimelineEvents
{"dependencies": {
"...": "...",
"com.uap.unitytimelineevents": "file:UnityTimelineEvents/Assets/TimelineEvents"
}}
{
"name": "com.uap.unitytimelineevents",
"displayName": "Unity Timeline Events",
"version": "0.0.1",
"unity": "2018.1",
"description": "Adds ability to execute arbitrary code, with int, bool, float, string and enum values, at both runtime and edit time, from Unity timelines.",
"dependencies": { }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment