UPM : Custom Package 만들기
Custom Unity Package 를 만들었을때 장점은 다음과같다.
장점 |
|
< Git : 에러 >
Package Password 틀릴경우
[Package Manager Window] Unable to add package [https://gitlab.com/minalfstudio/minalfstudiopackage.git/]:
Error when executing git command. remote: HTTP Basic: Access denied. The provided password or token is incorrect or your account has 2FA enabled and you must use a personal access token instead of a password. See https://gitlab.com/help/topics/git/troubleshooting_git#error-on-git-fetch-http-basic-access-denied
fatal: Authentication failed for 'https://gitlab.com/minalfstudio/minalfstudiopackage.git/'
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()
Git 저장소를 복제하거나 가져올 때
가장 자주 사용하는 두 가지 인증용 프로토콜은 HTTP(S)와 SSH(공용 및 프라이빗 SSH 키 페어)인데
HTTP(S)를 사용하면 GitHub 또는 GitLab에 로그인할 때마다 터미널이나 다이얼로그에 사용자 이름과 비밀번호를 입력해야 한다.
SSH를 사용하면 공용 SSH 키를 GitHub 또는 GitLab에 추가한 후 사용자 이름과 비밀번호를 입력하지 않고도 저장소에 액세스할 수 있어서 SSH로 설정하면 편리하지만 파일이 내부에 생성되어서 보안상 이슈가 생길 수 있다.
< Package에 포함이 가능한 항목>
패키지에 포함 될 수 있는 항목 |
|
패키지의 정보를 저장하는 package.json의 구조는 다음과 같다.
<package.json의 구조>
{
"name": "com.[company-name].[package-name]",
"version": "1.2.3",
"displayName": "Package Example",
"description": "This is an example package",
"unity": "2019.1",
"unityRelease": "0b5",
"documentationUrl": "https://example.com/",
"changelogUrl": "https://example.com/changelog.html",
"licensesUrl": "https://example.com/licensing.html",
"author": {
"name": "Unity",
"email": "unity@example.com",
"url": "https://www.unity3d.com"
}
"samples~":[
{
"displayName": "URP Shaders",
"description": "Contains sample shaders for the Universal render pipeline",
"path": "Samples~/SamplesUniversalRP"
},
{
"displayName": "Standard RP Shaders",
"description": "Contains sample shaders for the Standard render pipeline",
"path": "Samples~/SamplesStandard"
}
],
"keywords": [
"keyword1",
"keyword2",
"keyword3"
]
}
<참고 : Package Folder 구조>
<root>
├── package.json
├── README.md
├── CHANGELOG.md
├── LICENSE.md
├── Third Party Notices.md
├── Editor
│ ├── [company-name].[package-name].Editor.asmdef
│ └── EditorExample.cs
├── Runtime
│ ├── [company-name].[package-name].asmdef
│ └── RuntimeExample.cs
├── Tests
│ ├── Editor
│ │ ├── [company-name].[package-name].Editor.Tests.asmdef
│ │ └── EditorExampleTest.cs
│ └── Runtime
│ ├── [company-name].[package-name].Tests.asmdef
│ └── RuntimeExampleTest.cs
├── Samples~
│ ├── SampleFolder1
│ ├── SampleFolder2
│ └── ...
└── Documentation~
└── [package-name].md
로드방법은 Package Manager의 +에서 Git URL 을 통해서 변경하거나
직접 패키지의 경로를 입력해도된다. (Project / Pacakges / manifest.json)
custom pacakge의 UPM으로 로드하게되면 경로는 다음과 같다.
Project/Library/PackagesCache/패키지이름
< 패키지 변경(버전 변경) >
Custom Package를 변경하는경우에는 패키지 경로의 정보의 변경만 확인하면 된다.
프로젝트경로/Pcakages/manifest.json
프로젝트경로/Packages/packages-lock.json
2가지의 변경을 확인해야한다(packages-lock.json)은 Unity를 실행하는 시점에서 갱신된다.
<다른 패키지를 같이 사용하는 경우 종속성 추가>
+ 추가로 다른 패키지와 같이사용하려면 Dependency 설정을 해야 한다.
<package.json의 구조>
{
"name": "com.minalpeustudio.commonutill",
...
"dependencies":
{
"com.unity.inputsystem": "1.4.4"
}
}
<Asmdef 파일을 생성하고 Assembly Definition References를 추가한다>
< Git 에서 가져올때 특정 버전 선택하는 방법 >
Git 에서 가져올때 가져오는 방법 종류 : [링크]
Unity) UPM(Unity Pacakage Manager)패키지 특정 버전 선택하기(Git Dependencies)
UPM(Unity Pacakage Manager) 패키지 특정 버전 선택하기(Git Dependencies) UPM(Unity Package Manager)를 사용하는 과정에서 특정 패키지 버전을 사용해야하는 상황이 생길때(항상 최신이 아닌경우) Version 또는 Branc
drehzr.tistory.com
Unity 사용자 지정 패키지 만들기 : [링크]
Unity - Manual: Creating custom packages
Creating custom packages The Unity Package Manager is the official package management system for Unity. It does the following: Allows Unity to distribute new features and update existing features quickly and easily. Provides a platform for users to discove
docs.unity3d.com
Unity Git URL 을 통한 설치 : [링크]
Git URL을 통한 설치 - Unity 매뉴얼
패키지 관리자는 원격 서버의 Git 저장소에서 패키지를 로드할 수 있습니다.
docs.unity3d.com
Unity Git Dependencies : [링크]
Unity - Manual: Git dependencies
Local folder or tarball paths Git dependencies When the Package Manager fetches a package from a Git repository, it adds the package locally to your project. This allows you to test unpublished changes, but you can’t use it to contribute to that Git repo
docs.unity3d.com
★★★★★
'개발 > Unity' 카테고리의 다른 글
Unity) 다국어(언어변환) - 로컬라이징(Localization Setting) (0) | 2023.01.24 |
---|---|
Unity)Unity 에서 C# Version 확인방법 (0) | 2023.01.20 |
Unity) MenuItem (Check Menu) (0) | 2023.01.09 |
Unity) #unitytips (0) | 2023.01.06 |
Unity) 객체 복사 시 이름 규칙 (GameObject Copy Naming Scheme) (0) | 2023.01.04 |
댓글