๐ŸŽฎ Unity Study/Unity

[Unity] Custom Unity Package in Git ๋งน๋“ค๊ธฐ

ibelieveinme 2023. 9. 22. 16:36
728x90

ํšŒ์‚ฌ์—์„œ ํ”„๋กœ์ ํŠธ ๊ฐœ๋ฐœ์‹œ ํ•„์š”ํ•œ ๊ณตํ†ต๋ชจ๋“ˆ์„ ๊ฐ๊ฐ ๋‹ค์šด๋ฐ›์„ ์ˆ˜ ์žˆ๋Š” Editor ํ™”๋ฉด์„ ํ•˜๋‚˜ ๋งŒ๋“ค๊ณ  ์žˆ๋‹ค.

 

๋‹คํ–‰ํžˆ Unity ์—์„œ Git ์ €์žฅ์†Œ ์ •๋ณด๋ฅผ package.json ํŒŒ์ผ ์•ˆ์— ๋‹ด์•„์„œ ๊ทธ ํŒŒ์ผ์„ ๊ธฐ๋ฐ˜์œผ๋กœ ์ •๋ณด๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•œ๋‹ค.

(Unity Package Manager ์—์„œ Github ์— ์žˆ๋Š” ์˜คํ”ˆ ์†Œ์Šค๋ฅผ Git Url ๋กœ  ๋‹ค์šด๋ฐ›์•„๋ณธ ์ ์ด ์žˆ์„ ๊ฒƒ์ด๋‹ค).

 

Unity ์—์„œ ๊ถŒ์žฅํ•˜๋Š” Custom Package ๋ชจ์–‘์€ ๋‹ค์Œ๊ณผ ๊ฐ™๋‹ค.

 

Unity - Manual: Package layout

Adding tests to a package Package layout This is the package layout recommended for custom packages: โ”œโ”€โ”€ package.json โ”œโ”€โ”€ README.md โ”œโ”€โ”€ CHANGELOG.md โ”œโ”€โ”€ LICENSE.md โ”œโ”€โ”€ Third Party Notices.md โ”œโ”€โ”€ Editor โ”‚ โ”œโ”€โ”€ . .E

docs.unity3d.com


1. Unity Custom Package ๋ฅผ ๋งŒ๋“ค๊ธฐ ์œ„ํ•œ Unity ํ”„๋กœ์ ํŠธ์™€ Git Repository๋ฅผ ๋งŒ๋“ ๋‹ค.

๋‚˜์ค‘์— ์บก์ฒ˜ํ•ด์„œ ๋‚ด์šฉ์ด ์ฐจ์žˆ๋Š”๋ฐ, ๋นˆ Unity gitignore ๋ฅผ ํฌํ•จํ•œ Repository ๋ฅผ ๋งŒ๋“ค๋ฉด ๋œ๋‹ค.

 

 

2. Asset ํด๋” ์•ˆ์— ์œ„์—์„œ ๋งŒ๋“  GIt Repository๋ฅผ ๋‹ค์šด๋ฐ›๋Š”๋‹ค.

 

3. ์•„๋ž˜์™€ ๊ฐ™์ด ํด๋” ๋ฐ package.json ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.

๋‹ค์šด ๋ฐ›์€ custom package ๊ฒฝ๋กœ์— package.json ํŒŒ์ผ์„ ๋งŒ๋“ ๋‹ค.

(UPM(Unity PackageManager)์€ package.json ํŒŒ์ผ์„ ์ฝ์–ด์™€์„œ Unity Package Manger ์— ํ‘œ์‹œํ•œ๋‹ค.)

Runtime ํด๋”๋ฅผ ๋งŒ๋“ ๋‹ค.

Runtime ํด๋”์—๋Š” SampleToolKit(๊ฐ€์นญ) ์Šคํฌ๋ฆฝํŠธ๋ฅผ ๋งŒ๋“ ๋‹ค. Runtime ์‹œ์— ์ˆ˜ํ–‰ํ•  ๋‚ด์šฉ์„ ์ ๋Š” Script.

Editor Script ๋Š” Editor ํด๋”์—, Play Script ๋Š” Runtime ํด๋”์— ๋„ฃ๋Š”๋‹ค.

 

4. package.json ํŒŒ์ผ์„ ์ž‘์„ฑํ•œ๋‹ค.

name, version ๋‚ด์šฉ์€ Project Settings > Player ํ™”๋ฉด์—์„œ ํ™•์ธ ๋ฐ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ๋‹ค.

๊ฐ Key ๊ฐ’์— ๋”ฐ๋ฅธ UI, Function์ด UPM(Untiy Package Manger) ์— ์ •์˜๋˜์–ด ์žˆ๊ณ  ์ด๋ฅผ ํ™œ์šฉํ•˜๋Š” ๊ฒƒ.

 

 

5. ๋งŒ๋“  & ์ˆ˜์ •ํ•œ ๋‚ด์šฉ์„ Git์— Commit & Push ํ•œ๋‹ค.

 

6. Unity Package Manger ์—์„œ ๋‹ค์šด๋ฐ›์•„๋ณธ๋‹ค.

git URL ๋กœ package ๋ฅผ ์ถ”๊ฐ€ํ•ด๋ณด๋ฉด ์ •์ƒ์ ์œผ๋กœ ์ถ”๊ฐ€๋˜๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ๋‹ค.

 

package.json ํด๋”์— ์ ์€ ๋‚ด์šฉ ๋Œ€๋กœ UPM(Unity Package Manager)์—  ์ •๋ณด๊ฐ€ ํ‘œ์‹œ๋œ๋‹ค.

์ˆ˜์ •ํ•  ๋‚ด์šฉ์ด ์žˆ์œผ๋ฉด Git ์— Commit&Push ํ•˜๊ณ  Update ๋ฒ„ํŠผ์œผ๋กœ ํŽธ๋ฆฌํ•˜๊ฒŒ ์—…๋ฐ์ดํŠธ๊ฐ€ ๊ฐ€๋Šฅํ•˜๋‹ค.

 

P.S)

We can't assign a new GUID because the asset is in an immutable folder. The asset will be ignored.

์ฐธ๊ณ ๋กœ ์œ„ ์—๋Ÿฌ๊ฐ€ ๋œจ๋ฉด unity package๊ฐ€ ์ค‘๋ณต๋˜์–ด์„œ ์ƒ๊ธด ์˜ค๋ฅ˜์ด๋‹ค. ์ž‘์—…์™„๋ฃŒ ํ›„ sample-unity-package ๋Š” Packages ํด๋”์— ์žˆ์„ํ…Œ๋‹ˆ sample-unity-package ํด๋”๋ฅผ ์ง€์šฐ๋ฉด ๋œ๋‹ค.


์ฐธ๊ณ ) Unity Custom Package ์ƒ์„ฑ Document

https://docs.unity3d.com/kr/2021.3/Manual/CustomPackages.html#EmbedMe

 

์ปค์Šคํ…€ ํŒจํ‚ค์ง€ ์ƒ์„ฑ - Unity ๋งค๋‰ด์–ผ

Unity ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ์ž๋Š” Unity์˜ ๊ณต์‹ ํŒจํ‚ค์ง€ ๊ด€๋ฆฌ ์‹œ์Šคํ…œ์œผ๋กœ ๋‹ค์Œ๊ณผ ๊ฐ™์€ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.

docs.unity3d.com

 

์ฐธ๊ณ ) Unity Tutorial: Creating Your Own Custom Unity Package in Git

https://www.youtube.com/watch?v=31D46795veE 

 

728x90