├── .github ├── pull_request_template.md └── workflows │ ├── comment_automatic_rebase.yml │ ├── pr_assign_creator.yml │ ├── pr_title_semantic_validation.yml │ └── release_publish_to_npm.yml ├── .gitignore ├── CONTRIBUTING.md ├── PackageSampleProject ├── Assets │ ├── Scenes.meta │ └── Scenes │ │ ├── SampleScene.unity │ │ └── SampleScene.unity.meta └── Packages │ └── manifest.json ├── README.md ├── com.stansassets.package-sample ├── CHANGELOG.md ├── Documentation~ │ └── com.stansassets.package-sample.md ├── Editor │ ├── AssemblyInfo.cs │ ├── EditorExample.cs │ └── StansAssets.PackageSample.Editor.asmdef ├── LICENSE.md ├── README.md ├── Runtime │ ├── AssemblyInfo.cs │ ├── RuntimeExample.cs │ └── StansAssets.PackageSample.asmdef ├── Samples │ ├── Sample1 │ │ └── SampleExample.cs │ └── StansAssets.PackageSample.Samples.asmdef ├── Tests │ ├── Editor │ │ ├── EditorExampleTest.cs │ │ └── StansAssets.PackageSample.Editor.Tests.asmdef │ └── Runtime │ │ ├── RuntimeExampleTest.cs │ │ └── StansAssets.PackageSample.Tests.asmdef ├── Third Party Notices.md └── package.json └── init /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | ## Purpose of this PR 2 | 3 | 4 | ## Testing status 5 | 6 | * No tests have been added. 7 | * Includes unit tests. 8 | * Includes performance tests. 9 | * Includes integration tests. 10 | 11 | ### Manual testing status 12 | 13 | 14 | 15 | ## Comments to reviewers 16 | 17 | -------------------------------------------------------------------------------- /.github/workflows/comment_automatic_rebase.yml: -------------------------------------------------------------------------------- 1 | on: 2 | issue_comment: 3 | types: [created] 4 | name: Automatic Rebase 5 | jobs: 6 | rebase: 7 | name: Rebase 8 | if: github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') 9 | runs-on: ubuntu-latest 10 | steps: 11 | - uses: actions/checkout@master 12 | with: 13 | fetch-depth: 0 14 | - name: Automatic Rebase 15 | uses: cirrus-actions/rebase@1.2 16 | env: 17 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /.github/workflows/pr_assign_creator.yml: -------------------------------------------------------------------------------- 1 | name: Assign PR to it's author 2 | 3 | on: [pull_request] 4 | 5 | jobs: 6 | automation: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - name: Assign PR to creator 10 | uses: thomaseizinger/assign-pr-creator-action@v1.0.0 11 | if: github.event_name == 'pull_request' && github.event.action == 'opened' 12 | with: 13 | repo-token: ${{ secrets.GITHUB_TOKEN }} 14 | -------------------------------------------------------------------------------- /.github/workflows/pr_title_semantic_validation.yml: -------------------------------------------------------------------------------- 1 | name: "PR Title Convention Validation" 2 | on: 3 | pull_request: 4 | types: 5 | - opened 6 | - edited 7 | - synchronize 8 | 9 | jobs: 10 | main: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: amannn/action-semantic-pull-request@v1.1.1 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/release_publish_to_npm.yml: -------------------------------------------------------------------------------- 1 | name: Publish to npm 2 | 3 | # Controls when the action will run. 4 | # In this case, I'm saying on each release event when it's specifically a new release publish, the types: [published] is required here, 5 | # since releases could also be updated or deleted, we only want to publish to npm when a new release is created (published). 6 | on: 7 | release: 8 | types: [published, edited] 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 15 | - uses: actions/checkout@v2 16 | #Install Node.js, with the version 14 and using the registry URL of npm, this could be changed to a custom registry or the GitHub registry. 17 | - uses: actions/setup-node@v1 18 | with: 19 | node-version: 14 20 | registry-url: https://registry.npmjs.org/ 21 | 22 | # Publish to npm 23 | - run: npm publish --access public 24 | env: 25 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} 26 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Asset meta data should only be ignored when the corresponding asset is also ignored 2 | !/[Aa]ssets/**/*.meta 3 | 4 | # Uncomment this line if you wish to ignore the asset store tools plugin 5 | # /[Aa]ssets/AssetStoreTools* 6 | 7 | # Autogenerated Jetbrains Rider plugin 8 | [Aa]ssets/Plugins/Editor/JetBrains* 9 | 10 | # Visual Studio cache directory 11 | .vs/ 12 | 13 | # Gradle cache directory 14 | .gradle/ 15 | 16 | # Autogenerated VS/MD/Consulo solution and project files 17 | ExportedObj/ 18 | .consulo/ 19 | *.csproj 20 | *.unityproj 21 | *.sln 22 | *.suo 23 | *.tmp 24 | *.user 25 | *.userprefs 26 | *.pidb 27 | *.booproj 28 | *.svd 29 | *.pdb 30 | *.mdb 31 | *.opendb 32 | *.VC.db 33 | 34 | # Unity3D generated meta files 35 | *.pidb.meta 36 | *.pdb.meta 37 | *.mdb.meta 38 | 39 | # Unity3D generated file on crash reports 40 | sysinfo.txt 41 | 42 | # Builds 43 | *.apk 44 | *.unitypackage 45 | 46 | # Crashlytics generated file 47 | crashlytics-build.properties 48 | 49 | PackageSampleProject/.idea 50 | PackageSampleProject/obj 51 | PackageSampleProject/Logs 52 | PackageSampleProject/Temp 53 | PackageSampleProject/UserSettings 54 | PackageSampleProject/ProjectSettings 55 | PackageSampleProject/Library 56 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Thank you for spending time and effort contributing to this repository. We do appreciate it. If you have in mind some fundamental or just big change please first discuss the change you wish to make via issue, 4 | email, or any other method with the owners of this repository before making a change. 5 | 6 | Please note we have a [code of conduct](https://github.com/StansAssets/com.stansassets.foundation/wiki/Code-of-Conduct), 7 | and [code convention](https://github.com/StansAssets/com.stansassets.foundation/wiki/Code-Convention-Unity-C%23). Please follow it in all your interactions with the project. 8 | 9 | ## Pull Request Process 10 | 11 | 1. Follow the pull request template and describe what exact feature or fix you want to add and why do you think this is nessesary. 12 | If feature is accepted it's description will be included into the documentation. Please try to be as clear as possible, so we won't have to edit when updating the documentation. 13 | 2. Increase the version numbers in the `package.json` if nessesary. The versioning scheme we use is [SemVer](http://semver.org/). 14 | 3. Pull Request will be merged by reviewer. 15 | 16 | -------------------------------------------------------------------------------- /PackageSampleProject/Assets/Scenes.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 5f2a7b54d22644540b25c4176ab429c2 3 | folderAsset: yes 4 | DefaultImporter: 5 | externalObjects: {} 6 | userData: 7 | assetBundleName: 8 | assetBundleVariant: 9 | -------------------------------------------------------------------------------- /PackageSampleProject/Assets/Scenes/SampleScene.unity: -------------------------------------------------------------------------------- 1 | %YAML 1.1 2 | %TAG !u! tag:unity3d.com,2011: 3 | --- !u!29 &1 4 | OcclusionCullingSettings: 5 | m_ObjectHideFlags: 0 6 | serializedVersion: 2 7 | m_OcclusionBakeSettings: 8 | smallestOccluder: 5 9 | smallestHole: 0.25 10 | backfaceThreshold: 100 11 | m_SceneGUID: 00000000000000000000000000000000 12 | m_OcclusionCullingData: {fileID: 0} 13 | --- !u!104 &2 14 | RenderSettings: 15 | m_ObjectHideFlags: 0 16 | serializedVersion: 9 17 | m_Fog: 0 18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} 19 | m_FogMode: 3 20 | m_FogDensity: 0.01 21 | m_LinearFogStart: 0 22 | m_LinearFogEnd: 300 23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} 24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} 25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} 26 | m_AmbientIntensity: 1 27 | m_AmbientMode: 0 28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} 29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} 30 | m_HaloStrength: 0.5 31 | m_FlareStrength: 1 32 | m_FlareFadeSpeed: 3 33 | m_HaloTexture: {fileID: 0} 34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} 35 | m_DefaultReflectionMode: 0 36 | m_DefaultReflectionResolution: 128 37 | m_ReflectionBounces: 1 38 | m_ReflectionIntensity: 1 39 | m_CustomReflection: {fileID: 0} 40 | m_Sun: {fileID: 705507994} 41 | m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} 42 | m_UseRadianceAmbientProbe: 0 43 | --- !u!157 &3 44 | LightmapSettings: 45 | m_ObjectHideFlags: 0 46 | serializedVersion: 11 47 | m_GIWorkflowMode: 1 48 | m_GISettings: 49 | serializedVersion: 2 50 | m_BounceScale: 1 51 | m_IndirectOutputScale: 1 52 | m_AlbedoBoost: 1 53 | m_TemporalCoherenceThreshold: 1 54 | m_EnvironmentLightingMode: 0 55 | m_EnableBakedLightmaps: 1 56 | m_EnableRealtimeLightmaps: 0 57 | m_LightmapEditorSettings: 58 | serializedVersion: 10 59 | m_Resolution: 2 60 | m_BakeResolution: 40 61 | m_AtlasSize: 1024 62 | m_AO: 0 63 | m_AOMaxDistance: 1 64 | m_CompAOExponent: 1 65 | m_CompAOExponentDirect: 0 66 | m_Padding: 2 67 | m_LightmapParameters: {fileID: 0} 68 | m_LightmapsBakeMode: 1 69 | m_TextureCompression: 1 70 | m_FinalGather: 0 71 | m_FinalGatherFiltering: 1 72 | m_FinalGatherRayCount: 256 73 | m_ReflectionCompression: 2 74 | m_MixedBakeMode: 2 75 | m_BakeBackend: 1 76 | m_PVRSampling: 1 77 | m_PVRDirectSampleCount: 32 78 | m_PVRSampleCount: 500 79 | m_PVRBounces: 2 80 | m_PVRFilterTypeDirect: 0 81 | m_PVRFilterTypeIndirect: 0 82 | m_PVRFilterTypeAO: 0 83 | m_PVRFilteringMode: 1 84 | m_PVRCulling: 1 85 | m_PVRFilteringGaussRadiusDirect: 1 86 | m_PVRFilteringGaussRadiusIndirect: 5 87 | m_PVRFilteringGaussRadiusAO: 2 88 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5 89 | m_PVRFilteringAtrousPositionSigmaIndirect: 2 90 | m_PVRFilteringAtrousPositionSigmaAO: 1 91 | m_ShowResolutionOverlay: 1 92 | m_LightingDataAsset: {fileID: 0} 93 | m_UseShadowmask: 1 94 | --- !u!196 &4 95 | NavMeshSettings: 96 | serializedVersion: 2 97 | m_ObjectHideFlags: 0 98 | m_BuildSettings: 99 | serializedVersion: 2 100 | agentTypeID: 0 101 | agentRadius: 0.5 102 | agentHeight: 2 103 | agentSlope: 45 104 | agentClimb: 0.4 105 | ledgeDropHeight: 0 106 | maxJumpAcrossDistance: 0 107 | minRegionArea: 2 108 | manualCellSize: 0 109 | cellSize: 0.16666667 110 | manualTileSize: 0 111 | tileSize: 256 112 | accuratePlacement: 0 113 | debug: 114 | m_Flags: 0 115 | m_NavMeshData: {fileID: 0} 116 | --- !u!1 &705507993 117 | GameObject: 118 | m_ObjectHideFlags: 0 119 | m_CorrespondingSourceObject: {fileID: 0} 120 | m_PrefabInternal: {fileID: 0} 121 | serializedVersion: 6 122 | m_Component: 123 | - component: {fileID: 705507995} 124 | - component: {fileID: 705507994} 125 | m_Layer: 0 126 | m_Name: Directional Light 127 | m_TagString: Untagged 128 | m_Icon: {fileID: 0} 129 | m_NavMeshLayer: 0 130 | m_StaticEditorFlags: 0 131 | m_IsActive: 1 132 | --- !u!108 &705507994 133 | Light: 134 | m_ObjectHideFlags: 0 135 | m_CorrespondingSourceObject: {fileID: 0} 136 | m_PrefabInternal: {fileID: 0} 137 | m_GameObject: {fileID: 705507993} 138 | m_Enabled: 1 139 | serializedVersion: 8 140 | m_Type: 1 141 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} 142 | m_Intensity: 1 143 | m_Range: 10 144 | m_SpotAngle: 30 145 | m_CookieSize: 10 146 | m_Shadows: 147 | m_Type: 2 148 | m_Resolution: -1 149 | m_CustomResolution: -1 150 | m_Strength: 1 151 | m_Bias: 0.05 152 | m_NormalBias: 0.4 153 | m_NearPlane: 0.2 154 | m_Cookie: {fileID: 0} 155 | m_DrawHalo: 0 156 | m_Flare: {fileID: 0} 157 | m_RenderMode: 0 158 | m_CullingMask: 159 | serializedVersion: 2 160 | m_Bits: 4294967295 161 | m_Lightmapping: 1 162 | m_LightShadowCasterMode: 0 163 | m_AreaSize: {x: 1, y: 1} 164 | m_BounceIntensity: 1 165 | m_ColorTemperature: 6570 166 | m_UseColorTemperature: 0 167 | m_ShadowRadius: 0 168 | m_ShadowAngle: 0 169 | --- !u!4 &705507995 170 | Transform: 171 | m_ObjectHideFlags: 0 172 | m_CorrespondingSourceObject: {fileID: 0} 173 | m_PrefabInternal: {fileID: 0} 174 | m_GameObject: {fileID: 705507993} 175 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} 176 | m_LocalPosition: {x: 0, y: 3, z: 0} 177 | m_LocalScale: {x: 1, y: 1, z: 1} 178 | m_Children: [] 179 | m_Father: {fileID: 0} 180 | m_RootOrder: 1 181 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} 182 | --- !u!1 &963194225 183 | GameObject: 184 | m_ObjectHideFlags: 0 185 | m_CorrespondingSourceObject: {fileID: 0} 186 | m_PrefabInternal: {fileID: 0} 187 | serializedVersion: 6 188 | m_Component: 189 | - component: {fileID: 963194228} 190 | - component: {fileID: 963194227} 191 | - component: {fileID: 963194226} 192 | m_Layer: 0 193 | m_Name: Main Camera 194 | m_TagString: MainCamera 195 | m_Icon: {fileID: 0} 196 | m_NavMeshLayer: 0 197 | m_StaticEditorFlags: 0 198 | m_IsActive: 1 199 | --- !u!81 &963194226 200 | AudioListener: 201 | m_ObjectHideFlags: 0 202 | m_CorrespondingSourceObject: {fileID: 0} 203 | m_PrefabInternal: {fileID: 0} 204 | m_GameObject: {fileID: 963194225} 205 | m_Enabled: 1 206 | --- !u!20 &963194227 207 | Camera: 208 | m_ObjectHideFlags: 0 209 | m_CorrespondingSourceObject: {fileID: 0} 210 | m_PrefabInternal: {fileID: 0} 211 | m_GameObject: {fileID: 963194225} 212 | m_Enabled: 1 213 | serializedVersion: 2 214 | m_ClearFlags: 1 215 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} 216 | m_projectionMatrixMode: 1 217 | m_SensorSize: {x: 36, y: 24} 218 | m_LensShift: {x: 0, y: 0} 219 | m_GateFitMode: 2 220 | m_FocalLength: 50 221 | m_NormalizedViewPortRect: 222 | serializedVersion: 2 223 | x: 0 224 | y: 0 225 | width: 1 226 | height: 1 227 | near clip plane: 0.3 228 | far clip plane: 1000 229 | field of view: 60 230 | orthographic: 0 231 | orthographic size: 5 232 | m_Depth: -1 233 | m_CullingMask: 234 | serializedVersion: 2 235 | m_Bits: 4294967295 236 | m_RenderingPath: -1 237 | m_TargetTexture: {fileID: 0} 238 | m_TargetDisplay: 0 239 | m_TargetEye: 3 240 | m_HDR: 1 241 | m_AllowMSAA: 1 242 | m_AllowDynamicResolution: 0 243 | m_ForceIntoRT: 0 244 | m_OcclusionCulling: 1 245 | m_StereoConvergence: 10 246 | m_StereoSeparation: 0.022 247 | --- !u!4 &963194228 248 | Transform: 249 | m_ObjectHideFlags: 0 250 | m_CorrespondingSourceObject: {fileID: 0} 251 | m_PrefabInternal: {fileID: 0} 252 | m_GameObject: {fileID: 963194225} 253 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} 254 | m_LocalPosition: {x: 0, y: 1, z: -10} 255 | m_LocalScale: {x: 1, y: 1, z: 1} 256 | m_Children: [] 257 | m_Father: {fileID: 0} 258 | m_RootOrder: 0 259 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} 260 | -------------------------------------------------------------------------------- /PackageSampleProject/Assets/Scenes/SampleScene.unity.meta: -------------------------------------------------------------------------------- 1 | fileFormatVersion: 2 2 | guid: 9fc0d4010bbf28b4594072e72b8655ab 3 | DefaultImporter: 4 | externalObjects: {} 5 | userData: 6 | assetBundleName: 7 | assetBundleVariant: 8 | -------------------------------------------------------------------------------- /PackageSampleProject/Packages/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "scopedRegistries": [ 3 | { 4 | "name": "npmjs", 5 | "url": "https://registry.npmjs.org/", 6 | "scopes": [ 7 | "com.stansassets" 8 | ] 9 | } 10 | ], 11 | "dependencies": { 12 | "com.stansassets.package-sample": "file:../../com.stansassets.package-sample", 13 | "com.unity.collab-proxy": "1.3.7", 14 | "com.unity.ide.rider": "1.2.1", 15 | "com.unity.ide.visualstudio": "2.0.1", 16 | "com.unity.ide.vscode": "1.2.0", 17 | "com.unity.test-framework": "1.1.13", 18 | "com.unity.textmeshpro": "3.0.0-preview.1", 19 | "com.unity.timeline": "1.3.2", 20 | "com.unity.ugui": "1.0.0", 21 | "com.unity.modules.ai": "1.0.0", 22 | "com.unity.modules.androidjni": "1.0.0", 23 | "com.unity.modules.animation": "1.0.0", 24 | "com.unity.modules.assetbundle": "1.0.0", 25 | "com.unity.modules.audio": "1.0.0", 26 | "com.unity.modules.cloth": "1.0.0", 27 | "com.unity.modules.director": "1.0.0", 28 | "com.unity.modules.imageconversion": "1.0.0", 29 | "com.unity.modules.imgui": "1.0.0", 30 | "com.unity.modules.jsonserialize": "1.0.0", 31 | "com.unity.modules.particlesystem": "1.0.0", 32 | "com.unity.modules.physics": "1.0.0", 33 | "com.unity.modules.physics2d": "1.0.0", 34 | "com.unity.modules.screencapture": "1.0.0", 35 | "com.unity.modules.terrain": "1.0.0", 36 | "com.unity.modules.terrainphysics": "1.0.0", 37 | "com.unity.modules.tilemap": "1.0.0", 38 | "com.unity.modules.ui": "1.0.0", 39 | "com.unity.modules.uielements": "1.0.0", 40 | "com.unity.modules.umbra": "1.0.0", 41 | "com.unity.modules.unityanalytics": "1.0.0", 42 | "com.unity.modules.unitywebrequest": "1.0.0", 43 | "com.unity.modules.unitywebrequestassetbundle": "1.0.0", 44 | "com.unity.modules.unitywebrequestaudio": "1.0.0", 45 | "com.unity.modules.unitywebrequesttexture": "1.0.0", 46 | "com.unity.modules.unitywebrequestwww": "1.0.0", 47 | "com.unity.modules.vehicles": "1.0.0", 48 | "com.unity.modules.video": "1.0.0", 49 | "com.unity.modules.vr": "1.0.0", 50 | "com.unity.modules.wind": "1.0.0", 51 | "com.unity.modules.xr": "1.0.0" 52 | }, 53 | "testables" : ["com.stansassets.package-sample"] 54 | } 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Unity UPM Package Template. 2 | 3 | The purpose of this template is to give you a head start when creating a new package for Unity. You'll find the repository structure description below as well as why it was built this way. 4 | I assume you already have some basic understanding of what the UPM package is and why you would like to build one. If not, please check out [Creating custom packages](https://docs.unity3d.com/Manual/CustomPackages.html) 5 | 6 | ## How to use 7 | * Create a new repository and use this sample repository as a template. 8 | * Run init script `sh ` 9 | * Example1: `sh init com.my-company.unity.awesome-package MyCompany.AwesomePlugin` 10 | * Example2: `sh init com.stansassets.foundation Stansassets.Foundation` 11 | * Open `package.json` and update package metadata. You can do this by selecting `package.json` in the Unity Editor or just use any text editor you like. I would recommend using text editor since there are some additional data that isn't consumed by the Unity in the `package.json` 12 | 13 | ## Package manifest 14 | Unity uses the package manifest file `package.json` to manage information about a specific version of a specific package. The package manifest is always at the root of the package and contains crucial information about the package, such as its registered name and version number. [Full Package manifest Unity Guide](https://docs.unity3d.com/Manual/upm-manifestPkg.html) 15 | 16 | ### Required attributes 17 | * **name** - The officially registered package name. 18 | * **version** - The package version number (MAJOR.MINOR.PATCH). 19 | * **displayName** - A user-friendly name to appear in the Unity Editor. 20 | * **description** - A brief description of the package. 21 | * **unity** - Indicates the lowest Unity version the package is compatible with. 22 | 23 | ### Optional attributes 24 | * **unityRelease** - Part of a Unity version indicating the specific release of Unity that the package is compatible with. 25 | * **dependencies** - A map of package dependencies. 26 | * **keywords** - An array of keywords used by the Package Manager search APIs. 27 | * **author** - Author of the package. 28 | 29 | ### npmjs attributes 30 | This is only relevant if you are planning to distribute your package with npmjs. Otherwise, remove listed keywords from the `package.json` template. 31 | I will list attributes that will affect how your package is displayed on the npmjs package page. As an example, you can check out the [Foundation package page](https://www.npmjs.com/package/com.stansassets.foundation). But I would also recommend reading [Full npm-package.json guide](https://docs.npmjs.com/files/package.json.html) 32 | 33 | * **homepage** - The URL to the project homepage. 34 | * **bugs** - The URL to your project issue tracker and/or the email address to which issues should be reported. 35 | * **license** - Specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it. 36 | * **repository** - Specify the place where your code lives. 37 | 38 | ### Package manifest example 39 | This is how `package.json` looks like in our template repository: 40 | ```json 41 | { 42 | "name": "com.stansassets.package-sample", 43 | "displayName": "Stans Assets - Package Sample", 44 | "version": "0.0.1-preview", 45 | "unity": "2019.3", 46 | "description": "Package Sample.", 47 | "dependencies": { 48 | "com.stansassets.foundation": "1.0.2" 49 | }, 50 | "keywords": [ 51 | "keyword1", 52 | "keyword2", 53 | "keyword3" 54 | ], 55 | "license": "MIT", 56 | "author": { 57 | "name": "Stan's Assets", 58 | "email": "stan@stansassets.com", 59 | "url": "https://stansassets.com/" 60 | }, 61 | 62 | "homepage": "https://api.stansassets.com/", 63 | "bugs": { 64 | "url": "https://github.com/StansAssets/com.stansassets.foundation/issues", 65 | "email" : "support@stansassets.com" 66 | }, 67 | "repository": { 68 | "type": "git", 69 | "url": "ssh://git@github.com:StansAssets/com.stansassets.foundation.git" 70 | }, 71 | } 72 | ``` 73 | 74 | ## Repository structure 75 | * `init` - CLI init script. 76 | * `.github` - GitHub Settings & Actions 77 | * `.gitignore` - Git ignore file designed to this specific repository structure. 78 | * `README.md` - text file that introduces and explains a project. 79 | * `PackageSampleProject` - Team shared project for package development. 80 | * `com.stansassets.package-sample` - UMP package. 81 | 82 | This structure was chosen for the following reasons: 83 | 1. Scalability. Since the package isn't located in the repository root, you can host more than one package in the repository. 84 | 2. You have the Unity Project that your team may use to work on a package. There are a few benefits of having the project already set: 85 | * Team members (especially the ones who haven't worked with the project before) won't have to go thought the project set up. 86 | * Project already linked to the package using a [local](https://docs.unity3d.com/Manual/upm-localpath.html) relative path. 87 | * You can have Additional scripts, resources, another package. Whatever could help you develop the package but should not be part of the package release. 88 | * You can have additional settings defined in your project `manifest.json` For example project from this template has stansassets npmjs score registry defined. 89 | 90 | ```json 91 | "scopedRegistries": [ 92 | { 93 | "name": "npmjs", 94 | "url": "https://registry.npmjs.org/", 95 | "scopes": [ 96 | "com.stansassets" 97 | ] 98 | } 99 | ], 100 | "dependencies": { 101 | "com.stansassets.package-sample": "file:../../com.stansassets.package-sample", 102 | ``` 103 | 104 | Note: 105 | * If you are planning to distribute your package via [Git URL](https://docs.unity3d.com/Manual/upm-git.html), this structure would not work for you. In this case, you will need to place your package in the repository root. 106 | * Template `.gitignore` will also ignore project settings. The motivation here, is that you need to ensure that your package will run on different Unity editor versions/configurations and your team members might be jumping between those versions. Adding ProjectSettins into `.gitignore` will help to avoid conflicts between developers. 107 | 108 | ## Package Info 109 | You are not obligated to provide any description files with your package, but to be a good citizen it's nice to at least ship the following files for your project. 110 | And you probably want all the links to work when your package is viewed in the [Package Manager window](https://docs.unity3d.com/Manual/upm-ui.html) 111 | ![](https://user-images.githubusercontent.com/12031497/81487789-bab70780-9269-11ea-87b9-5a453c332d21.png) 112 | 113 | ### LICENSE.md 114 | You should specify a license for your package so that people know how they are permitted to use it, and any restrictions you’re placing on it. 115 | The template repository `LICENSE.md` file already comes the MIT license. 116 | 117 | ### CHANGELOG.md 118 | A changelog is a file that contains a curated, chronologically ordered list of notable changes for each version of a project. To make it easier for users and contributors to see precisely what notable changes have been made between each release (or version) of the project. 119 | The template repository `CHANGELOG.md` has some sample records based on [keep a changelog](https://keepachangelog.com/) standard. 120 | 121 | ### Documentation~/YourPackageName.md 122 | The fill contains and offline package documentation. I recommend placing the package description and links to the web documentation into that file. 123 | 124 | ### README.md 125 | I do not think I have to explain why this is important :) Besides this file will be used to make home page content for your package if you distribute it on [npm](https://www.npmjs.com/) or [openUPM](https://openupm.com/). The template repository `README.md` already contains some content that describes how to install your package via [npm](https://www.npmjs.com/), [openUPM](https://openupm.com/) or [Git URL](https://docs.unity3d.com/Manual/upm-git.html) 126 | 127 | There are also some cool badges you would probably like to use. The [Foundation package](https://github.com/StansAssets/com.stansassets.foundation) is a good example of how it can look like: 128 | ![](https://user-images.githubusercontent.com/12031497/81487844-4892f280-926a-11ea-9418-df89e427652b.png) 129 | 130 | ## Package layout 131 | The repository package layout follows an [official Unity packages convetion](https://docs.unity3d.com/Manual/cus-layout.html). 132 | 133 | ``` 134 | 135 | ├── package.json 136 | ├── README.md 137 | ├── CHANGELOG.md 138 | ├── LICENSE.md 139 | ├── Editor 140 | │ ├── Unity.[YourPackageName].Editor.asmdef 141 | │ └── EditorExample.cs 142 | ├── Runtime 143 | │ ├── Unity.[YourPackageName].asmdef 144 | │ └── RuntimeExample.cs 145 | ├── Tests 146 | │ ├── Editor 147 | │ │ ├── Unity.[YourPackageName].Editor.Tests.asmdef 148 | │ │ └── EditorExampleTest.cs 149 | │ └── Runtime 150 | │ ├── Unity.[YourPackageName].Tests.asmdef 151 | │ └── RuntimeExampleTest.cs 152 | └── Documentation~ 153 | └── [YourPackageName].md 154 | ``` 155 | The only commend I would like to add if you not using something (for example, you do not have tests atm) or your package does not have Editor API. Please remove unused folders and `*.asmdef` files. 156 | The same if you aren't keeping changelog up to date, then remove the `CHANGELOG.md`. 157 | 158 | Keeping unused & not maintained parts in the published product is misleading for the users, please avoid. 159 | 160 | ## CI / CD 161 | It's important to have, it will save your development time. Again this is something I don't have to explain, let's just go straight to what we already have set in this package template repository. 162 | 163 | ### Publish to NPM 164 | The action will publish package to npmjs every time the new GitHub release is created. The full article about this action and package distribution and publishing automation can be found [here](https://github.com/StansAssets/com.stansassets.foundation/wiki/Publish-Unity-package-with-NPMJS). 165 | * Action file: **publish-to-npm.yml** 166 | * Setup: 167 | * Update `` with the package name that needs to be published. 168 | * Add _NPM_TOKEN_ to the reprository Secrets. 169 | 170 | ### Assign PR Creator 171 | This GitHub action will assign pull requests to their authors. 172 | * Action file: **assign-pr-creator.yml** 173 | * Setup: not setup actions needed. 174 | 175 | ### Automatically Rebase PRs 176 | Simply comment `/rebase` to trigger the action. Read more about rebase action [here](https://github.com/cirrus-actions/rebase) 177 | * Action file: **automatic-rebase.yml** 178 | * Setup: not setup actions needed. 179 | 180 | 181 | ### Next Steps 182 | To make me completely happy about this template there should be few more set up steps. But I think we will get to it with the next article. 183 | 184 | * Automatic `CHANGELOG.md` generation. We are already feeling up the release notes, I don't see the reason why we have to do it again the `CHANGELOG.md` when we can simply have an automated commit before publishing to npm action. 185 | * Editor and Playmode tests. It's not a real CI until we have no tests running. 186 | * Docfx + GitHub Pages documentation static website generation. 187 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | ## [Unreleased] - yyyy-mm-dd 8 | 9 | Here we write upgrading notes for brands. It's a team effort to make them as 10 | straightforward as possible. 11 | 12 | ### Added 13 | - [PROJECTNAME-XXXX](http://tickets.projectname.com/browse/PROJECTNAME-XXXX) 14 | MINOR Ticket title goes here. 15 | - [PROJECTNAME-YYYY](http://tickets.projectname.com/browse/PROJECTNAME-YYYY) 16 | PATCH Ticket title goes here. 17 | 18 | ### Changed 19 | 20 | ### Fixed 21 | 22 | ## [1.2.4] - 2017-03-15 23 | 24 | Here we would have the update steps for 1.2.4 for people to follow. 25 | 26 | ### Added 27 | 28 | ### Changed 29 | 30 | - [PROJECTNAME-ZZZZ](http://tickets.projectname.com/browse/PROJECTNAME-ZZZZ) 31 | PATCH Drupal.org is now used for composer. 32 | 33 | ### Fixed 34 | 35 | - [PROJECTNAME-TTTT](http://tickets.projectname.com/browse/PROJECTNAME-TTTT) 36 | PATCH Add logic to runsheet teaser delete to delete corresponding 37 | schedule cards. 38 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Documentation~/com.stansassets.package-sample.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | This file will be opened on `View Documentation` button click in the [Package Manager Window](https://docs.unity3d.com/Manual/upm-ui.html) 4 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Editor/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("StansAssets.PackageSample.EditorTests")] 4 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Editor/EditorExample.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // Editor C# Script Sample 3 | // ----------------------------------------------------------------------------- 4 | 5 | namespace StansAssets.PackageSample.Editor 6 | { 7 | /// 8 | /// Make sure you have documentation for ALL public Package APIs. 9 | /// 1 class = 1 file preferable. 10 | /// 11 | /// You may skip internal classes / methods documentation. 12 | /// But make sure to document anything that would surprise another engineer (or yourself when you've forgotten it). 13 | /// 14 | /// You can use normal markdown, such as **bold**, *italics*, and `code` formatting. 15 | /// Links: [Unity](https://unity.com/) 16 | /// Refs: 17 | /// 18 | /// 19 | /// For more information on using the XML Documentation comments and the supported tags, 20 | /// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments 21 | /// 22 | /// Code convention: 23 | /// https://github.com/StansAssets/com.stansassets.foundation/wiki/Code-Convention-Unity-C%23 24 | /// 25 | public class MyPublicEditorExampleClass 26 | { 27 | /// 28 | /// If you want to document your public enum, use `summary` tags before each value. 29 | /// 30 | public enum MyExampleEnum 31 | { 32 | /// 33 | /// Description of value 1 34 | /// 35 | First = 0, 36 | /// 37 | /// Description of value 2 38 | /// 39 | Second = 1, 40 | } 41 | 42 | /// 43 | /// For properties, you can add a description of the property to get/set with the `value` tag. 44 | /// 45 | /// Description of the property 46 | public MyExampleEnum PropertyExample => MyExampleEnum.First; 47 | 48 | /// 49 | /// Besides providing a summary you should also describe each parameter 50 | /// using the `param` tag and document return values with the `return` tag. 51 | /// 52 | /// Description of parameter 1. 53 | /// Description of parameter 2. 54 | /// Description of what the function returns. 55 | public int DoSomething(int parameter1, int parameter2) 56 | { 57 | return parameter1 + parameter2; 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Editor/StansAssets.PackageSample.Editor.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StansAssets.PackageSample.Editor", 3 | "references": [], 4 | "includePlatforms": [ 5 | "Editor" 6 | ], 7 | "excludePlatforms": [], 8 | "allowUnsafeCode": false, 9 | "overrideReferences": false, 10 | "precompiledReferences": [], 11 | "autoReferenced": true, 12 | "defineConstraints": [], 13 | "versionDefines": [], 14 | "noEngineReferences": false 15 | } -------------------------------------------------------------------------------- /com.stansassets.package-sample/LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Stan's Assets 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/README.md: -------------------------------------------------------------------------------- 1 | # Package Sample 2 | 3 | 4 | [![NPM Package](https://img.shields.io/npm/v/com.stansassets.package-sample)](https://www.npmjs.com/package/com.stansassets.package-sample) 5 | [![openupm](https://img.shields.io/npm/v/com.stansassets.package-sample?label=openupm®istry_uri=https://package.openupm.com)](https://openupm.com/packages/com.stansassets.package-sample/) 6 | [![Licence](https://img.shields.io/npm/l/com.stansassets.package-sample)](https://github.com/StansAssets/com.stansassets.package-sample/blob/master/LICENSE) 7 | [![Issues](https://img.shields.io/github/issues/StansAssets/com.stansassets.package-sample)](https://github.com/StansAssets/com.stansassets.package-sample/issues) 8 | 9 | 10 | 11 | [API Reference](https://myapi) | [Forum](https://myforum) | [Wiki](https://github.com/StansAssets/com.stansassets.package-sample/wiki) 12 | 13 | ### Install from NPM 14 | * Navigate to the `Packages` directory of your project. 15 | * Adjust the [project manifest file](https://docs.unity3d.com/Manual/upm-manifestPrj.html) `manifest.json` in a text editor. 16 | * Ensure `https://registry.npmjs.org/` is part of `scopedRegistries`. 17 | * Ensure `com.stansassets` is part of `scopes`. 18 | * Add `com.stansassets.package-sample` to the `dependencies`, stating the latest version. 19 | 20 | A minimal example ends up looking like this. Please note that the version `X.Y.Z` stated here is to be replaced with [the latest released version](https://www.npmjs.com/package/com.stansassets.foundation) which is currently [![NPM Package](https://img.shields.io/npm/v/com.stansassets.foundation)](https://www.npmjs.com/package/com.stansassets.foundation). 21 | ```json 22 | { 23 | "scopedRegistries": [ 24 | { 25 | "name": "npmjs", 26 | "url": "https://registry.npmjs.org/", 27 | "scopes": [ 28 | "com.stansassets" 29 | ] 30 | } 31 | ], 32 | "dependencies": { 33 | "com.stansassets.package-sample": "X.Y.Z", 34 | ... 35 | } 36 | } 37 | ``` 38 | * Switch back to the Unity software and wait for it to finish importing the added package. 39 | 40 | ### Install from OpenUPM 41 | * Install openupm-cli `npm install -g openupm-cli` or `yarn global add openupm-cli` 42 | * Enter your unity project folder `cd ` 43 | * Install package `openupm add com.stansassets.package-sample` 44 | 45 | ### Install from a Git URL 46 | Yoy can also install this package via Git URL. To load a package from a Git URL: 47 | 48 | * Open [Unity Package Manager](https://docs.unity3d.com/Manual/upm-ui.html) window. 49 | * Click the add **+** button in the status bar. 50 | * The options for adding packages appear. 51 | * Select Add package from git URL from the add menu. A text box and an Add button appear. 52 | * Enter the `https://github.com/StansAssets/com.stansassets.package-sample.git` Git URL in the text box and click Add. 53 | * You may also install a specific package version by using the URL with the specified version. 54 | * `https://github.com/StansAssets/com.stansassets.package-sample#X.Y.X` 55 | * Please note that the version `X.Y.Z` stated here is to be replaced with the version you would like to get. 56 | * You can find all the available releases [here](https://github.com/StansAssets/com.stansassets.package-sample/releases). 57 | * The latest available release version is [![Last Release](https://img.shields.io/github/v/release/stansassets/com.stansassets.package-sample)](https://github.com/StansAssets/com.stansassets.package-sample/releases/latest) 58 | 59 | For more information about what protocols Unity supports, see [Git URLs](https://docs.unity3d.com/Manual/upm-git.html). 60 | 61 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Runtime/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("StansAssets.PackageSample.Tests")] 4 | [assembly: InternalsVisibleTo("StansAssets.PackageSample.EditorTests")] 5 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Runtime/RuntimeExample.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // Runtime C# Script Sample 3 | // ----------------------------------------------------------------------------- 4 | 5 | namespace StansAssets.PackageSample 6 | { 7 | /// 8 | /// Make sure you have documentation for ALL public Package APIs. 9 | /// 1 class = 1 file preferable. 10 | /// 11 | /// You may skip internal classes / methods documentation. 12 | /// But make sure to document anything that would surprise another engineer (or yourself when you've forgotten it). 13 | /// 14 | /// You can use normal markdown, such as **bold**, *italics*, and `code` formatting. 15 | /// Links: [Unity](https://unity.com/) 16 | /// Refs: 17 | /// 18 | /// 19 | /// For more information on using the XML Documentation comments and the supported tags, 20 | /// https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/xmldoc/xml-documentation-comments 21 | /// 22 | /// Code convention: 23 | /// https://github.com/StansAssets/com.stansassets.foundation/wiki/Code-Convention-Unity-C%23 24 | /// 25 | public class MyPublicRuntimeExampleClass 26 | { 27 | /// 28 | /// If you want to document your public enum, use `summary` tags before each value. 29 | /// 30 | public enum MyExampleEnum 31 | { 32 | /// 33 | /// Description of value 1 34 | /// 35 | First = 0, 36 | /// 37 | /// Description of value 2 38 | /// 39 | Second = 1, 40 | } 41 | 42 | /// 43 | /// For properties, you can add a description of the property to get/set with the `value` tag. 44 | /// 45 | /// Description of the property 46 | public MyExampleEnum PropertyExample => MyExampleEnum.First; 47 | 48 | /// 49 | /// Besides providing a summary you should also describe each parameter 50 | /// using the `param` tag and document return values with the `return` tag. 51 | /// 52 | /// Description of parameter 1. 53 | /// Description of parameter 2. 54 | /// Description of what the function returns. 55 | public int DoSomething(int parameter1, int parameter2) 56 | { 57 | return parameter1 + parameter2; 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Runtime/StansAssets.PackageSample.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StansAssets.PackageSample", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [] 6 | } 7 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Samples/Sample1/SampleExample.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // Provide samples how to use your package API. 3 | // ----------------------------------------------------------------------------- 4 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Samples/StansAssets.PackageSample.Samples.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StansAssets.PackageSample.Samples", 3 | "references": [], 4 | "includePlatforms": [], 5 | "excludePlatforms": [], 6 | "allowUnsafeCode": false, 7 | "overrideReferences": false, 8 | "precompiledReferences": [], 9 | "autoReferenced": true, 10 | "defineConstraints": [], 11 | "versionDefines": [], 12 | "noEngineReferences": false 13 | } -------------------------------------------------------------------------------- /com.stansassets.package-sample/Tests/Editor/EditorExampleTest.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // Package Editor Tests. 3 | // Test Framework 4 | // https://docs.unity3d.com/Manual/com.unity.test-framework.html 5 | // 6 | // For embedded packages you don’t need to explicitly enable tests because embedded packages are in development. 7 | // However, for other types of dependencies, you need to add the `testables` attribute to the Project `manifest.json` 8 | // "testables" : ["com.stansassets.package-sample"] 9 | // ----------------------------------------------------------------------------- 10 | 11 | using UnityEngine.TestTools; 12 | using NUnit.Framework; 13 | using System.Collections; 14 | using UnityEngine; 15 | 16 | namespace StansAssets.PackageSample.Editor.Tests 17 | { 18 | class EditorExampleTest 19 | { 20 | [SetUp] 21 | public void Setup() 22 | { 23 | // Called before each test method is called. 24 | } 25 | 26 | [OneTimeSetUp] 27 | public void OneTimeSetUp() 28 | { 29 | // Called once prior to executing any of the tests in a fixture 30 | } 31 | 32 | [UnitySetUp] 33 | public IEnumerator UnitySetUp() 34 | { 35 | // Identical to the standard SetUp. 36 | yield return null; 37 | } 38 | 39 | [TearDown] 40 | public void TearDown() 41 | { 42 | // Called after each test method. 43 | } 44 | 45 | [OneTimeTearDown] 46 | public void OneTimeTearDown() 47 | { 48 | // Called once after executing any of the tests in a fixture. 49 | } 50 | 51 | [UnityTearDown] 52 | public IEnumerator UnityTearDown() 53 | { 54 | // Identical to the standard TearDown. 55 | yield return null; 56 | } 57 | 58 | [Test] 59 | public void SimpleTest() 60 | { 61 | // Simple Test 62 | Assert.That(1, Is.EqualTo(1)); 63 | } 64 | 65 | [Test] 66 | [UnityPlatform(RuntimePlatform.WindowsPlayer, RuntimePlatform.Android)] 67 | public void TestMethod() 68 | { 69 | // Run test only for defined platforms 70 | Assert.AreEqual(Application.platform, RuntimePlatform.WindowsPlayer); 71 | } 72 | 73 | [Test] 74 | [TestCase("Alex", 101)] 75 | [TestCase("Pavel", 777)] 76 | [TestCase("Stan", 707)] 77 | public void TestMethod(string name, int id) 78 | { 79 | // TestCase sample. 80 | } 81 | 82 | [Test, Ignore("Described the reason why ignored")] 83 | public void IgnoredTest() 84 | { 85 | // Ignore test example. 86 | } 87 | 88 | [UnityTest] 89 | public IEnumerator EditorSampleTestWithEnumeratorPasses() 90 | { 91 | // A UnityTest behaves like a coroutine in PlayMode 92 | // and allows you to yield null to skip a frame in EditMode 93 | yield return null; 94 | Assert.That(1, Is.EqualTo(1)); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Tests/Editor/StansAssets.PackageSample.Editor.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StansAssets.PackageSample.Editor.Tests", 3 | "references": [ 4 | "UnityEngine.TestRunner", 5 | "UnityEditor.TestRunner" 6 | ], 7 | "includePlatforms": [ 8 | "Editor" 9 | ], 10 | "excludePlatforms": [], 11 | "allowUnsafeCode": false, 12 | "overrideReferences": true, 13 | "precompiledReferences": [ 14 | "nunit.framework.dll" 15 | ], 16 | "autoReferenced": false, 17 | "defineConstraints": [ 18 | "UNITY_INCLUDE_TESTS" 19 | ], 20 | "versionDefines": [], 21 | "noEngineReferences": false 22 | } -------------------------------------------------------------------------------- /com.stansassets.package-sample/Tests/Runtime/RuntimeExampleTest.cs: -------------------------------------------------------------------------------- 1 | // ----------------------------------------------------------------------------- 2 | // Package Runtime Tests. 3 | // Test Framework 4 | // https://docs.unity3d.com/Manual/com.unity.test-framework.html 5 | // 6 | // For embedded packages you don’t need to explicitly enable tests because embedded packages are in development. 7 | // However, for other types of dependencies, you need to add the `testables` attribute to the Project `manifest.json` 8 | // "testables" : ["com.stansassets.package-sample"] 9 | // ----------------------------------------------------------------------------- 10 | 11 | using UnityEngine.TestTools; 12 | using NUnit.Framework; 13 | using System.Collections; 14 | using UnityEngine; 15 | 16 | namespace StansAssets.PackageSample.Tests 17 | { 18 | class RuntimeExampleTest 19 | { 20 | [SetUp] 21 | public void Setup() 22 | { 23 | // Called before each test method is called. 24 | } 25 | 26 | [OneTimeSetUp] 27 | public void OneTimeSetUp() 28 | { 29 | // Called once prior to executing any of the tests in a fixture 30 | } 31 | 32 | [UnitySetUp] 33 | public IEnumerator UnitySetUp() 34 | { 35 | // Identical to the standard SetUp. 36 | yield return null; 37 | } 38 | 39 | [TearDown] 40 | public void TearDown() 41 | { 42 | // Called after each test method. 43 | } 44 | 45 | [OneTimeTearDown] 46 | public void OneTimeTearDown() 47 | { 48 | // Called once after executing any of the tests in a fixture. 49 | } 50 | 51 | [UnityTearDown] 52 | public IEnumerator UnityTearDown() 53 | { 54 | // Identical to the standard TearDown. 55 | yield return null; 56 | } 57 | 58 | [Test] 59 | public void SimpleTest() 60 | { 61 | // Simple Test 62 | Assert.That(1, Is.EqualTo(1)); 63 | } 64 | 65 | [Test] 66 | [UnityPlatform(RuntimePlatform.WindowsPlayer, RuntimePlatform.Android)] 67 | public void TestMethod() 68 | { 69 | // Run test only for defined platforms 70 | Assert.AreEqual(Application.platform, RuntimePlatform.WindowsPlayer); 71 | } 72 | 73 | [Test] 74 | [TestCase("Alex", 101)] 75 | [TestCase("Pavel", 777)] 76 | [TestCase("Stan", 707)] 77 | public void TestMethod(string name, int id) 78 | { 79 | // TestCase sample. 80 | } 81 | 82 | [Test, Ignore("Described the reason why ignored")] 83 | public void IgnoredTest() 84 | { 85 | // Ignore test example. 86 | } 87 | 88 | [UnityTest] 89 | public IEnumerator EditorSampleTestWithEnumeratorPasses() 90 | { 91 | // A UnityTest behaves like a coroutine in PlayMode 92 | // and allows you to yield null to skip a frame in EditMode 93 | yield return null; 94 | Assert.That(1, Is.EqualTo(1)); 95 | } 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/Tests/Runtime/StansAssets.PackageSample.Tests.asmdef: -------------------------------------------------------------------------------- 1 | { 2 | "name": "StansAssets.PackageSample.Tests", 3 | "references": [ 4 | "UnityEngine.TestRunner", 5 | "UnityEditor.TestRunner" 6 | ], 7 | "includePlatforms": [], 8 | "excludePlatforms": [], 9 | "allowUnsafeCode": false, 10 | "overrideReferences": true, 11 | "precompiledReferences": [ 12 | "nunit.framework.dll" 13 | ], 14 | "autoReferenced": false, 15 | "defineConstraints": [ 16 | "UNITY_INCLUDE_TESTS" 17 | ], 18 | "versionDefines": [], 19 | "noEngineReferences": false 20 | } -------------------------------------------------------------------------------- /com.stansassets.package-sample/Third Party Notices.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | This package contains third-party software components governed by the license(s) indicated below: 4 | 5 | Component Name: Semver 6 | 7 | License Type: "MIT" 8 | 9 | [SemVer License](https://github.com/myusername/semver/blob/master/License.txt) 10 | 11 | 12 | Component Name: MyComponent 13 | 14 | License Type: "MyLicense" 15 | 16 | [MyComponent License](https://www.mycompany.com/licenses/License.txt) 17 | -------------------------------------------------------------------------------- /com.stansassets.package-sample/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "com.stansassets.package-sample", 3 | "displayName": "Stans Assets - Package Sample", 4 | "version": "0.0.1-preview", 5 | "unity": "2019.3", 6 | "description": "Package Sample.", 7 | "dependencies": { 8 | "com.stansassets.foundation": "1.0.2" 9 | }, 10 | "keywords": [ 11 | "keyword1", 12 | "keyword2", 13 | "keyword3" 14 | ], 15 | "license": "MIT", 16 | "author": { 17 | "name": "Stan's Assets", 18 | "email": "stan@stansassets.com", 19 | "url": "https://stansassets.com/" 20 | }, 21 | 22 | "homepage": "https://api.stansassets.com/", 23 | "bugs": { 24 | "url": "https://github.com/StansAssets/com.stansassets.foundation/issues", 25 | "email" : "support@stansassets.com" 26 | }, 27 | "repository": { 28 | "type": "git", 29 | "url": "ssh://git@github.com:StansAssets/com.stansassets.foundation.git" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /init: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | #package name 4 | LC_ALL=C find . -type f -name '*.json' -exec sed -i '' "s/com.stansassets.package-sample/$1/g" {} + 5 | LC_ALL=C find . -type f -name '*.cs' -exec sed -i '' "s/com.stansassets.package-sample/$1/g" {} + 6 | LC_ALL=C find . -type f -name '*.md' -exec sed -i '' "s/com.stansassets.package-sample/$1/g" {} + 7 | 8 | #namespace 9 | LC_ALL=C find . -type f -name '*.cs' -exec sed -i '' "s/StansAssets.PackageSample/$2/g" {} + 10 | LC_ALL=C find . -type f -name '*.asmdef' -exec sed -i '' "s/StansAssets.PackageSample/$2/g" {} + 11 | 12 | #rename files 13 | find . -type f -name 'StansAssets.PackageSample*' | while read FILE ; do 14 | regexp="s/StansAssets.PackageSample/$2/"; 15 | newfile="$(echo ${FILE} | sed -e ${regexp})"; 16 | mv "${FILE}" "${newfile}"; 17 | done 18 | 19 | mv 'com.stansassets.package-sample' "${1}"; 20 | 21 | PROJECT_NAME=$(echo "$2" | sed 's/^.*\.//') 22 | mv 'PackageSampleProject' "${PROJECT_NAME}Project"; 23 | find . -type f -name 'com.stansassets.package-sample*' | while read FILE ; do 24 | regexp="s/com.stansassets.package-sample/$1/"; 25 | newfile="$(echo ${FILE} | sed -e ${regexp})"; 26 | mv "${FILE}" "${newfile}"; 27 | done 28 | 29 | 30 | echo "package name: $1" 31 | echo "package namespace: $2" 32 | --------------------------------------------------------------------------------