BuildMagicã¯ãéçºã»æ¬çªãªã©ã®è€æ°ã®èšå®ã管çãããã«ããã€ãã©ã€ã³ã®æ§ç¯ããµããŒããããã«ããŠãŒãã£ãªãã£ã§ãã ãŠãŒã¶ãŒãã¬ã³ããªãŒãªã€ã³ã¿ãŒãã§ã€ã¹ãæäŸããç¹ã«Unityã®ã¢ããªãã«ãã§ããå¿ èŠã«ãªããã«ãã¿ã¹ã¯ããã«ãã€ã³ã§æäŸããŸãã
- BuildMagic
Unityã®ã¢ããªããã«ãããéãéçºæãæ¬çªæãªã©ã§ç°ãªãèšå®ãé©çšããå¿ èŠããããŸãã
äŸãã°ãPlayerSettings
ãªã©ã®Unityæšæºã®APIã«å¯Ÿããèšå®ãããã°ãã¢ããªã±ãŒã·ã§ã³ã®æ¥ç¶å
ãµãŒããŒã®URLãå°å
¥ããSDKã®èšå®ãªã©ããããžã§ã¯ãç¬èªã®èšå®ããããŸãã
Build Magicã¯è€æ°ã®ãã«ãèšå®ãå¹çãã管çããèšå®ãé©çšããããã®UI/CIã€ã³ã¿ãŒãã§ãŒã¹ãæäŸããŸãã
PlayerSettings ã EditorUserBuildSettings ãªã©ã®Unityæšæºã®å šãŠã®APIã«ã€ããŠã¯ãæšæºã®èšå®ç»é¢ã«ãªããã®ãå«ããŠããŒã³ãŒãã§èšå®ã®å€æŽãè¡ããããã«ãªã£ãŠãããããèšå®ã®è² æ ã軜æžãããŠããŸãã
ãŸãããããžã§ã¯ãåºæã®èšå®ã«ã€ããŠã¯ãæ¡åŒµAPIã䜿çšããããšã§åãUIäžã§ç®¡çã§ããŸãã
BuildMagicã§ã¯ãã«ããã€ãã©ã€ã³ã®å®è¡ãã¢ããªãã«ãã®ããã®CLIãæšæºã§çšæããŠãããããGitHub ActionsãJenkinsäžã§ã®ã¢ããªãã«ããç°¡åã«è¡ãããšãã§ããŸãã
Unityäžã®UIãéããŠãã«ãèšå®ã管çã§ããããã«ããããšã§ãCIåŽã®ç®¡çè² æ ãæžããããšãã§ããŸããã³ãã³ãã©ã€ã³åŒæ°ã«ãã£ãŠãã©ã¡ãŒã¿ãéšåçã«ãªãŒããŒã©ã€ãããããšãå¯èœãªã®ã§ãCIã«ããã¢ãããã¯ãªãã«ãèšå®ã®å€æŽãå¯èœã§ãã
BuildMagicã§ã¯ãéçºã»æ¬çªãªã©ã®èšå®ã ãã«ãã¹ããŒã (Build Scheme) ãšããåäœã§ç®¡çããŸãã
ãã«ãã¹ããŒã ã¯è€æ°ã® ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ (Build Configuration) ãæã¡ãŸãã
ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã¯ããã³ãã«IDã®èšå®ãã¢ããªã±ãŒã·ã§ã³ã¢ã€ã³ã³ã®èšå®ãè¡ã ãã«ãã¿ã¹ã¯ ãšãå®éã«ã©ã®ãããªå€ãèšå®ãããã®ãã©ã¡ãŒã¿ãŒãä¿æããŠããŸãã
以äžã®å³ã«ããã«ãã¹ããŒã ããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ããã«ãã¿ã¹ã¯ã®é¢ä¿ã瀺ããŸãã
- è€æ°ã®ãã«ãã¹ããŒã ã®ç®¡ç : è€æ°ã®ãã«ãã¹ããŒã ãä¿æããããšãã§ããéçºã»æ¬çªãªã©ã®èšå®ã®åãæ¿ããç°¡åã«è¡ãããšãã§ããŸãã
- ãã«ãã€ã³ã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã®æäŸ :
PlayerSettings
ãEditorUserBuildSettings
ã®æäœãªã©ãããå¿ èŠã«ãªããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ããã«ãã€ã³ã§æäŸããŸãã - ç¬èªã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã®å®è£ : ç¬èªã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãçšæããããšã§ã容æã«ãã«ããã€ãã©ã€ã³ãæ¡åŒµããããšãã§ããŸãã
- ã³ãã³ãã©ã€ã³ã®ãµããŒã: CI/CDããŒã«ããã®å©çšãæ³å®ããã³ãã³ãã©ã€ã³çµç±ã§ã®èšå®ã®åãæ¿ããããã«ãã®å®è¡ããµããŒãããŸãã
Unity 6 以éã§ã¯ãBuild Profilesãšããæšæºæ©èœã«ãã£ãŠè€æ°ã®ãã«ãèšå®ãåãæ¿ããŠãã«ãã§ããããã«ãªããŸããã
BuildMagic 㯠Build Profiles ãšã¯ç°ãªãããã«ãèšå®ã ãã§ã¯ãªããããå æ¬ãããã«ããã€ãã©ã€ã³ãšããŠãããæœè±¡çãªæŠå¿µãæäŸããŸãã
ãŸãã次ã®ãããªæ©èœäžã®å·®ç°ããããŸãã
- éšåçãªèšå®ã®é©çš: Build Profilesã§ã¯PlayerSettingsçã®é©çšãäžæ¬ã§è¡ããŸãããBuildMagicã§ã¯åèšå®é ç®ããšã«ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãå®çŸ©ãããŠãããåå¥ã®é ç®ã®ã¿ããªãŒããŒã©ã€ãã§ããŸãã
- æ¡åŒµæ§: BuildMagicã§ã¯ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãç¬èªã«å®è£ ããããšã§ããããžã§ã¯ãåºæã®èšå®ã管çã§ããŸãã
- 管çæ§: BuildMagicã®ãã«ãã¹ããŒã ã¯ã人éã«ãèªã¿ãããJSON圢åŒã§ã·ãªã¢ã©ã€ãºãããŸãã
Unity 2022.3.12f1以éã«å¯Ÿå¿ããŠããŸãã
Package Managerãã以äžã® git URL ãè¿œå ããŠãã ããïŒ
https://github.com/CyberAgentGameEntertainment/BuildMagic.git?path=/Packages/jp.co.cyberagent.buildmagic
æ°ãããã«ãã¹ããŒã ãè¿œå ããã«ã¯ãBuildMagicãŠã€ã³ããŠãå©çšããŸãã
ãã¡ãã¥ãŒ > Window > Build MagicããéžæãããBuildMagicããŠã£ã³ããŠãéããŸãã
次ã«ãBuildMagicãŠã€ã³ããŠã®å·Šäžã«ãããMenuããã¯ãªãã¯ããŠã§ãã«ããŠã³ã¡ãã¥ãŒãå±éãããCreate a build schemeããéžæããŸãã
ãããšããBuild Scheme CreatorããŠã€ã³ããŠãéããŸãã ããã§ãNameããã£ãŒã«ãã«æ°ãããã«ãã¹ããŒã ã®ååãå ¥åãããCreateããã¿ã³ãã¯ãªãã¯ããããšã§æ°ãããã«ãã¹ããŒã ãäœæã§ããŸãã
ãªãããCopy fromããæå®ããããšã§ãæå®ããã¹ããŒã ãå ã«æ°ããªãã«ãã¹ããŒã ãäœæããããšãå¯èœã§ãã
Note
Base ã«ã€ããŠã¯ããã«ãã¹ããŒã ã®ç¶æ¿ãã芧ãã ããã
ãŸãããBuildMagicããŠã£ã³ããŠãéããå·ŠåŽã®ãã€ã³ããç·šé察象ã®ãã«ãã¹ããŒã ãéžæããŸãã
æ°ããªãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãè¿œå ããããã«ã¯ãå³åŽã®ãã€ã³ã®å·Šäžã«ãããAdd Configurationããã¯ãªãã¯ããŸãã
次ã«ãäžå³ã®ããã«è¡šç€ºãããããããããŠã³ã¡ãã¥ãŒãããè¿œå ããããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãéžæããŸãã
éžæåŸãBuildMagicãŠã£ã³ããŠã®å³åŽã®ãã€ã³ã«ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãè¿œå ãããŸããããã§ããã®èšå®å€ãç·šéããŸãã
ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã«ã¯ãå®è¡ãããã¿ã€ãã³ã°ã«å¿ããŠãPreBuildãããPostBuildãã®2ã€ã®ãã§ãŒãºããããŸãã ãã§ãŒãºã®è©³çŽ°ã«ã€ããŠã¯ã³ãã³ãã©ã€ã³ã€ã³ã¿ãŒãã§ã€ã¹ïŒCLIïŒããã¢ããªããã«ããã ã«èšèŒããŠããŸãã
ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãåé€ããå Žåã¯ãåé€å¯Ÿè±¡ã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³äžã§å³ã¯ãªãã¯ãããRemove the configurationããéžæããŸãã
ãããžã§ã¯ãã®èšå®ããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã«åæ ãããå Žåã¯ãåæ 察象ã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³äžã§å³ã¯ãªãã¯ãããCollect a project settingããéžæããŸãã
èšå®ã®ç·šéãå®äºãããããSaveããã¿ã³ãã¯ãªãã¯ããŠèšå®ãä¿åããŸãã
Unityãããžã§ã¯ãã®èšå®ãéžæãããã«ãã¹ããŒã ã®ãã®ã«åãæ¿ããã«ã¯ãå·Šãã€ã³ã§åæ ãããããã«ãã¹ããŒã ãéžæããŸãã ãã®åŸãBuildMagicãŠã€ã³ããŠã®ç»é¢å·Šäžã«ãããMenuããã¯ãªãã¯ããŠãã«ããŠã³ã¡ãã¥ãŒãéãããSwitch selected build schemeããéžæããŸãã
BuildMagicãŠã€ã³ããŠã®ç»é¢å·Šäžã«ãããMenuããã¯ãªãã¯ããŠãã«ããŠã³ã¡ãã¥ãŒãéãããBuild with selected schemeããéžæããããšã§ã¢ããªããã«ãã§ããŸãã
ãããã«ãã¹ããŒã ãç¶æ¿ããèšå®ã®è¿œå ãŸãã¯äžæžããããããšãã§ããŸãã
ãã«ãã¹ããŒã ãäœæããéãç¶æ¿å ãšãªããã«ãã¹ããŒã ã Base ãšããŠæå®ããŠãã ããã ä»ã®ãã«ãã¹ããŒã ãç¶æ¿ããŠäœæãããã«ãã¹ããŒã ãUIäžã§éžæãããšãDerived ãšããé ç®ã«ç¶æ¿å ã®ãã«ãã¹ããŒã ã«å«ãŸãããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã衚瀺ãããŸãã èšå®ã®è¿œå ã»äžæžãã¯ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³åäœã§è¡ãããŸãã
Warning
ãããã«ãã¹ããŒã ãç¶æ¿ãããã«ãã¹ããŒã ããããã«ç¶æ¿ããããšã¯ã§ããŸããã
BuildMagicã¯ãã³ãã³ãã©ã€ã³çµç±ã§ã®å®è¡ããµããŒãããŠããŸãã
ã³ãã³ãã©ã€ã³ã§ã®ã¢ããªãã«ãã¯ããPreBuildãã§ãŒãºããšãPostBuildãã§ãŒãºãã®2ã€ã®ãã§ãŒãºã«åãããŠããŸãã
- PreBuildãã§ãŒãº:
- ãã©ãããã©ãŒã ã®åãæ¿ããšãBuildMagicã管çãããã«ãèšå®ããããžã§ã¯ãã«é©çšãããã§ãŒãºã§ãã
- ãã®ãã§ãŒãºã§ãDefine Symbolsã®æŽæ°ãã¢ã»ããããœãŒã¹ã³ãŒãã®ç©çåé€ãè¡ããŸãã
- PostBuildãã§ãŒãº:
BuildPipeline.BuildPlayer
ãä»ããŠUnityã¢ããªããã«ãããåŸã«å®è¡ããããã§ãŒãºã§ã
ãã®ã¢ãããŒããæ¡çšããŠããã®ã¯ãã³ãã³ãã©ã€ã³çµç±ã®ãããã¢ãŒãå®è¡ã§ã¯ãã¡ã€ã³ãªããŒããã§ããªãããã§ãã ãã©ãããã©ãŒã ãDefine Symbolsã®æŽæ°ãè¡ã£ãåãããã»ã¹ã§ãã«ããå®è¡ãããšãã³ãŒãã®åã³ã³ãã€ã«ãæ£åžžã«è¡ããããæåŸ ãããã«ããåŸãããªãå¯èœæ§ããããŸãã
åè: Unity - Manual: Custom scripting symbols
So, for example, if you use this method in an Editor script, then immediately call BuildPipeline.BuildPlayer on the following line in the same script, at that point Unity is still running your Editor scripts with the old set of scripting symbols, because they have not yet been recompiled with the new symbols. This means if you have Editor scripts which run as part of your BuildPlayer execution, they run with the old scripting symbols and your player might not build as you expected.
以äžã¯ãmacOSäžã§CLIãå©çšããŠãã«ããå®è¡ããäŸã§ãã
# ãã¬ãã«ããã§ãŒãºã®å®è¡
/Path/to/Unity -projectPath /Path/To/Project -quit -batchmode -executeMethod BuildMagicCLI.PreBuild \
-scheme ${BUILD_MAGIC_SCHEME_NAME} \
-override KEY1=VALUE1 -override KEY2=VALUE2
# ãã«ããã§ãŒãºã®å®è¡
/Path/to/Unity -projectPath /Path/To/Project -quit -batchmode -executeMethod BuildMagicCLI.Build \
-scheme ${BUILD_MAGIC_SCHEME_NAME} \
-override KEY1=VALUE1 -override KEY2=VALUE2
ã³ãã³ãã©ã€ã³ã®ãªãã·ã§ã³åŒæ°ã¯äžèšã®ãšããã§ãã
ãªãã·ã§ã³åŒæ° | 説æ | å |
---|---|---|
-scheme |
é©çšãããã«ãã¹ããŒã ã®ååãæå®ããŸãã | string |
-override |
ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã®å€ãäžæžãããŸãã | string |
-strict |
ãã«ãäžã«äžã€ã§ããšã©ãŒãã°åºåãããã°ããã«ãçµæã«é¢ããã倱æãšããŸãã | bool (flag) |
ã³ãã³ãã©ã€ã³ã®æ»ãå€ã¯ãäžèšã®ãšããã§ãã
æ»ãå€ | 説æ |
---|---|
0 |
ãã«ããæ£åžžã«å®äºããéã«è¿åŽãããŸãã |
0ä»¥å€ |
ãã«ãäžã«äŸå€ãæãããããªã©ã§ç°åžžçµäºããéã«è¿åŽãããŸãã |
ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã®åèšå®å€ã¯ãCLIå®è¡æã« -override
ãªãã·ã§ã³ãæå®ããããšã§äžæžããå¯èœã§ãã-override
ã¯ãKEY=VALUE
ã®åœ¢åŒã§æå®ããŸãã
KEYã«ã¯ãæžãæããããã«ãã¹ããŒã ã®ããŒå€ãæå®ããŸãã
ãã®ããŒå€ã¯ãBuildTaskBase<T>
ãç¶æ¿ããã¯ã©ã¹ã«ã€ãã GenerateBuildTaskAccessories
å±æ§ã® PropertyName
ã§æå®ããå€ã«ãªããŸãã
å®éã®ããŒå€ã¯ãäžå³ã®ããã«BuildMagicãŠã€ã³ããŠã§ãã«ãã¹ããŒã ã«ãŒãœã«ãåãããŠå³ã¯ãªãã¯ãããCopy the configuration keyããéžæããããšã§ã¯ãªããããŒãã«ã³ããŒã§ããŸãã
ãŸããæå®ãããã«ãã¹ããŒã å ã«è©²åœãããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãååšããªãå Žåã¯ãæ°ãã«ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãäœæãããã«ãã¿ã¹ã¯ãå®è¡ãããŸãã
BuildMagicã§ã¯ã BuildTaskBase<T>
ãçšããŠãã«ãã¿ã¹ã¯ãå®çŸ©ããŸãã
äŸãã°ãã¢ããªã±ãŒã·ã§ã³ã®ååãèšå®ããããã®ãã«ãã€ã³ã¿ã¹ã¯ PlayerSettingsSetProductNameTask
ã¯ã次ã®ããã« BuildTaskBase<T>
ãç¶æ¿ããŠå®è£
ãããŠããŸãã
[BuildMagicEditor.GenerateBuildTaskAccessories(@"PlayerSettings: Product Name", PropertyName = @"PlayerSettings.ProductName")]
public class PlayerSettingsSetProductNameTask : BuildMagicEditor.BuildTaskBase<BuildMagicEditor.IPreBuildContext>
{
public PlayerSettingsSetProductNameTask(string productName)
{
this.productName = productName;
}
public override void Run(BuildMagicEditor.IPreBuildContext context)
{
UnityEditor.PlayerSettings.productName = this.productName;
}
private readonly string productName;
}
åãã©ã¡ãŒã¿ T
ã¯ããã®ã¿ã¹ã¯ãã©ã®ãã§ãŒãºã§å®è¡ãããããè¡šãã³ã³ããã¹ãåã§ãã
BuildMagicã§ã¯ããã«ãã¿ã¹ã¯ãå®è¡ãããã§ãŒãºã以äžã®3ã€ã«åããŠããŸãã
Phase | Description | ContextType |
---|---|---|
PreBuild | ãããžã§ã¯ããžèšå®ãé©çšãããã§ãŒãºããã«ããã§ãŒãºã®æåã«å®è¡ãããŸãã | IPreBuildConetxt |
PostBuild | ãã«ããã¬ã€ã€ãŒã«ããã¢ããªã±ãŒã·ã§ã³ã®ãã«ãåŸã«å®è¡ããããã§ãŒãºã | IPostBuildContext |
ãPreBuildãã§ãŒãºã§ã¯ãUnityãããžã§ã¯ããžã®åçš®èšå®ã®åæ ãScript Define Symbolsã®é©çšãããã³ç©ççãªã³ãŒãã®é€å€ãªã©ã«ããC#ã³ãŒãã®æŽæ°ãè¡ããŸãã
ãPostBuildããã§ãŒãºã§ã¯ããã«ããããã¢ããªã±ãŒã·ã§ã³ããããžã§ã¯ãã«å¯ŸããŠè¿œå ã®åŠçãå®è¡ããŸãã
BuildMagicã§ã¯ãç¬èªã®ãã«ãã¿ã¹ã¯ãå®çŸ©ããããšã§ããããžã§ã¯ãåºæã®èšå®ãä¿æã»åæ ããããšãã§ããŸãã
äŸãã°ã次ã®ãã㪠SampleApiSetting
ãšããèšå®ããããšããŸãã
using System;
using UnityEngine;
[CreateAssetMenu(
fileName = "SampleApiSettings",
menuName = "Build Magic/Samples/Sample ApiSettings")]
[Serializable]
public class SampleApiSetting : ScriptableObject
{
[SerializeField] public string Url;
[SerializeField] public int Port;
}
ãã®èšå®ãBuildMagicã«ãã管çã»åæ ããããã®ãã«ãã¿ã¹ã¯ã¯ã次ã®ããã«å®è£ ããŸãã
using BuildMagicEditor;
using UnityEditor;
// ãã«ãã¿ã¹ã¯ã管çããããã«å¿
èŠãªå±æ§ã®å®çŸ©
[GenerateBuildTaskAccessories(
// displayNameã¯BuildMagicãŠã€ã³ããŠã§è¡šç€ºããããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã®åå
"Sample Api Setting",
// PropertyNameã¯åŸè¿°ããCLIå®è¡ã§ã®ãã«ãæã®ãªãŒããŒã©ã€ãã®ããŒãšããŠå©çšãã
PropertyName = "SampleApiSetting")]
public class SampleApiSettingBuildTask : BuildTaskBase<IPreBuildContext>
{
private readonly string _url;
private readonly int _port;
// ãã®èšå®ã§æŽæ°ã§å¿
èŠãªå€ã¯ããã¹ãŠã¿ã¹ã¯ã®ã³ã³ã¹ãã©ã¯ã¿åŒæ°ããšãããã«ãã
public SampleApiSettingBuildTask(string url, int port)
{
_url = url;
_port = port;
}
public override void Run(IPreBuildContext context)
{
// ä¿æããŠããèšå®ããããžã§ã¯ãã«åæ ããå®è£
ãRunå
ã«èšè¿°ãã
var setting = AssetDatabase.LoadAssetAtPath<SampleApiSetting>(
"Assets/Settings/SampleApiSettings.asset");
if (setting != null)
{
setting.Url = _url;
setting.Port = _port;
EditorUtility.SetDirty(setting);
}
}
}
ãã«ãã¿ã¹ã¯ã¯ BuildTaskBase<T>
ãç¶æ¿ããŠå®è£
ããT
ã«ã¯é©çšããããã§ãŒãºã®ã³ã³ããã¹ãåãæå®ããŸãã
äžèšã®å®è£
ã§ã¯ IPreBuildContext
ãæå®ããŠããããããã¬ãã«ããã§ãŒãºã§å®è¡ããããã«ãã¿ã¹ã¯ãšãªããŸãã
ãŸãããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã®èªåçæã®ããã«ãGenerateBuildTaskAccessories
å±æ§ããã³ BuildConfiguration
å±æ§ãä»äžããŸãã
ãã®ãã«ãã¿ã¹ã¯ã«å¿
èŠãªèšå®å€ã¯ããã¹ãŠã³ã³ã¹ãã©ã¯ã¿åŒæ°ãšããŠåãåãããã«å®è£
ããŸãã
å®éã®ãã«ãã¿ã¹ã¯ã®åŠçã¯ãRun(T context)
ã¡ãœããå
ã«èšè¿°ããŸãã
ãã®ãããªå®è£ ãè¡ãããšã§ã以äžã®ããã«BuildMagicã«ç¬èªã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãè¿œå ããããšãã§ããŸãã
çæããããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã«å¯Ÿã㊠IProjectSettingApplier
ãå®è£
ããããšã§ã
ãããžã§ã¯ãåŽã®èšå®ããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã«åæ ããããšãã§ããŸãã
以äžã«ãSampleApiSettingBuildTaskConfiguration
ã«å¯Ÿãã IProjectSettingApplier
ã®å®è£
äŸã瀺ããŸãã
// SampleApiSettingBuildTaskãšãããã«ãã¿ã¹ã¯ã«å¯ŸããŠã
// SampleApiSettingBuildTaskConfigurationãšããååã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ãèªåçæããã
// ãã®ã¯ã©ã¹ã¯partialã§å®çŸ©ãããŠããã®ã§ãäžèšã®ããã«partialã§IPorjectSettingApplierãå®è£
ãã
public partial class SampleApiSettingBuildTaskConfiguration : IProjectSettingApplier
{
void IProjectSettingApplier.ApplyProjectSetting()
{
// ãããžã§ã¯ãåŽã®èšå®å€ãåç
§ãã
var setting = AssetDatabase.LoadAssetAtPath<SampleApiSetting>("Assets/Settings/SampleApiSettings.asset");
if (setting != null)
{
// Valueãšããããããã£ã«èšå®å€ãåæ ããã
// SampleApiSettingBuildTaskã«å¯ŸããŠã
// SampleApiSettingBuildTaskParametersãšãããã©ã¡ãŒã¿ãŒã¯ã©ã¹ãèªåçæãããã®ã§
// ãã®å€ãèšå®ããããšã§ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³åŽã«èšå®å€ãåæ ãããããšãã§ãã
Value = new SampleApiSettingBuildTaskParameters
{
port = setting.Port,
url = setting.Url
};
}
}
}
以äžã®ãã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³ã¯ãBuildMagicã«ãã«ãã€ã³ã§æäŸãããŠããŸãã
- ãã¬ãã«ããã§ãŒãºã«é©çšããããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³
- ãã«ããã§ãŒãºã«é©çšããããã«ãã³ã³ãã£ã®ã¥ã¬ãŒã·ã§ã³