ã¯ããã«
èªè ã®çãããããã«ã¡ã¯ãä»æ¥ã®èšäºã§ã¯ã Unity3dã§ã®ã¢ããªã±ãŒã·ã§ã³éçºã«ããããèŠèŠçéçºãããæ£ç¢ºã«ã¯ã³ãŒããšããžãã¯ã®èŠèŠçè¡šçŸã䜿çšããéçºãªã©ã®çŸè±¡ã«ã€ããŠèª¬æããŸãã ãããŠãç¶è¡ããåã«ãããã«æ確ã«ãããã®ã§ãããã絶察ã«ããšããèšèãããããžã¥ã¢ã«ããã°ã©ãã³ã°ã«ã€ããŠã¯è©±ããŠããŸãããUnityã®äžçã§ã®ãã«ãŒããªã³ãã®ããªãšãŒã·ã§ã³ãCïŒã³ãŒãã®çæã¯ãããŸããã ã§ã¯ãããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒãšã¯ã©ãããæå³ã§ããïŒ ãã®è³ªåãžã®çãã«èå³ãããã°ãç«ã®äžã§æè¿ããŸãã
ããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒãšã¯
éçºäžãããã°ã©ãã¯åžžã«ãã·ã¹ãã ã®ãã®ããã²ãŒã ã®ä»çµã¿ãŸã§ãããŸããŸãªããšãè¡ãããŸããŸãªã³ãŒããããããæžããšäž»åŒµãã人ãããŸãã ããã°ã©ãããæ¬ç©ãã§ããå Žåããã®ã³ãŒãã¯éåžžãåå©çšã§ããããã«çµ±åããã³åé¢ãããŸãïŒUnityå ã§ã¯ããã®ã³ãŒãã¯ã³ã³ããŒãã³ãã§ããã MonoBehaviorã®ç¶æ¿è ã§ããããŸã ïŒã ç¹ã«ãããæåã®ãããžã§ã¯ãã§ãªãå Žåããã®ãããªã³ãŒããããããããããšãæ³åããããšã¯é£ãããããŸããã ä»ãç§ãã¡ãæ°ãããããžã§ã¯ããå§ããŠãããå€ãã®é«éã§ç°ãªããããã¿ã€ããäœæããå¿ èŠããããããã°ã©ããŒã®ããŒã ã¯éãããŠããã誰ããã¡ã€ã³ãããžã§ã¯ãã§å¿ãããšæ³åããŠã¿ãŸãããã ã²ãŒã ãã¶ã€ããŒã¯inããŠããã®ã§ããã¹ãããã§ãã¯ããããã¥ãŒãµãŒããããŒãžã£ãŒãé§ãåã£ãŠããã°ã©ããŒãåŒãåºãããšããŠããããéãéãããŠãããæéã足ããªãããªã©ãå¿ èŠã§ãã
ã³ã€ã³ã®å察åŽã§ããç§ãã¡ïŒããã°ã©ããŒïŒã¯ãã³ã³ããŒãã³ãã®åœ¢ã§å€ãã®ã³ãŒããäœæããŸããããããã¯ã·ãŒã³å ã®ããŸããŸãªãªããžã§ã¯ãã®å€§ããªãªã¹ãã«ãã³ã°ã¢ããããŸãã ãããŠãç§ãã¡ã¯ããŒã ãæ¡å€§ããæ°ããããã°ã©ããŒãæ¡çšãã圌ã¯ãããæŽçããããã«ã¹ããŒãžãéãã誰ã誰ããã©ã®é åºã§ãã©ã®ã³ã³ããŒãã³ããã©ã®æ¹æ³ã§ãã©ã®ããã«æ¥ç¶ããã®ããªã©ãããŸããŸãªè³ªåã«inããŸããããã¥ã¡ã³ããŒã·ã§ã³ã¯ãããŸããïŒãïŒããã¥ã¡ã³ããŒã·ã§ã³ã¯ãããŸãããäºå®ã§ã¯ãããŸãããïŒããã§ã®ãã€ã³ãã¯ãæ°ãã人ãããŒã ã«åå ããããã®ãããå€ãå¯èœãªéãäœãããã®ããã»ã¹ã®æéãå¯èœãªéãçãããããšã§ãã
äžèšã®ç¶æ³ã解決ããæ¹æ³ã¯ïŒ èšäºã®ã¿ã€ãã«ã®çãã¯Visual Logic Editorã§ãã ããã¯äœïŒ ããã¯ãããžãã¯ã®ããŸããŸãªã³ã³ããŒãã³ããèŠèŠçã«æäœãããããã®é¢ä¿ïŒããœãããããŒãžã§ã³ïŒãæ§æããã·ãŒã³ã®ãªããžã§ã¯ããã·ãŒã³ããéæ¥çã«æäœã§ããç°å¢ã§ãã ãããéæ¹ããªãã·ã³ãã«ãªåœ¢ã§èª¬æãããšã幌å°æã«ãã¥ãŒãããç°ãªããã¶ã€ã³ãçµã¿ç«ãŠããããªãã®ã§ãïŒãã®å Žåã®ã¿ããã¥ãŒãã¯ãã£ãããšæ¥ç¶ãããŠããããåºé¢ãåãé€ããããã¶ã€ã³ã¯èœã¡ãŸããïŒã
ããã§ãç§ãã¡ã¯å®çŸ©ãç解ããŸããããããã¯æçµçã«ç§ãã¡ã«äœãäžããŸããïŒ
- ãããžã§ã¯ãã§åå©çšã§ãããŠãããŒãµã«ãã¶ã€ã³ãåéã§ããããããã®åŸã®ã«ãŒãã³ãåæžã§ããŸãã ç§ãã¡ã®ãããžã§ã¯ãã§ããäžçš®ã®çŽç²ãªãã£ãŒã«ããæ³åããŠãã ãããå¥ã®ã²ãŒã ããçµã¿ç«ãŠãããæ§é ãåãåºããããããã£ãŒã«ãã«çœ®ãã ãã§ãã
- åé¢ãããããã¥ãŒããïŒæ©æ¢°ãããžãã¯ãæ©èœïŒã®ããŒã¿ããŒã¹ãäœæã§ããŸãããã®ããŒã¿ããŒã¹ãããããã°ã©ããŒã§ã¯ãªã人ãèªåã§æ§é ãçµã¿ç«ãŠãããšãã§ããŸãã
- ãã¶ã€ã³ããªã³ã¶ãã©ã€ã§ä»ã®ãã¶ã€ã³ã«çœ®ãæããŠãããžãã¯ã®åäœãå€æŽããããšãã§ããŸãã
- æ§ç¯ç©ãé 延ã¢ãŒãã§äœ¿çšã§ããŸããããšãã°ãçŸåšNPCãäžçã«ååšããªãå Žåãããã«é¢é£ä»ããããããžãã¯ã¯ããã£ãŒã«ããã«ååšããŸããã
- ãã¥ãŒãã¯ãªãžãããªã¬ãŒã·ã§ã³ã·ããã«ãã£ãŠæ¥ç¶ãããŠããªããããå¿ èŠã«å¿ããŠãã¥ãŒãããªãããã³ãªã³ã«ããŠãä»»æã®è€éãªæ¡ä»¶ä»ãããã³ç¡æ¡ä»¶åå²ãå®è£ ã§ããŸãã
ãŸããããã¯ããªãè¯ãé³ã§ããïŒ ããããå®éã«ã¯äœã§ããïŒ Asset StoreãéããŠVisual Scriptingã»ã¯ã·ã§ã³ãèŠããšãååãšããŠå€æ°ã®ç°ãªããã©ã°ã€ã³ãèŠãããšãã§ããŸãã ãããã®ã»ãšãã©ã¯ãUnreal Engineã®ãã«ãŒããªã³ãããŒãã®ããªãšãŒã·ã§ã³ã§ããã€ãŸããæ¬è³ªçã«ã¯ã³ãŒãçæã§ãã ããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒã®æŠå¿µã«é©åããã·ã¹ãã ã¯ãå®éã«ã¯ãããŸããã æãè¿ãæå³ã¯æ¬¡ã®ãšããã§ãã
- ãã¬ã€ã¡ãŒã«ãŒ ã¯ããFSMãã©ã°ã€ã³ã§ãããããã§ããç¬èªã®ã¢ã¯ã·ã§ã³ãäœæã§ããŸãã ã€ã³ã¿ãŒãã§ã€ã¹ã®èŠ³ç¹ããã¯ããã»ã©äŸ¿å©ã§ã¯ãããŸããããç¹å®ã®ç¹ã§ã¯éåžžã«åªããŠããŸãã ããªã¶ãŒãã¯ãããŒã¹ã¹ããŒã³ã§äœ¿çšãããç¡é§ã§ã¯ãããŸããã§ããã
- Behavior Designer / MoonBehaviorãªã© ç¶æ ããªãŒãã©ã°ã€ã³ã äžèšã«è¿ããã®ã§ãããå€ãã®å¶éããããŸããçµå±ã®ãšãããç¶æ ããªãŒã¯ã³ã³ããŒãã³ãã«é¢ããæ¬æ Œçãªããžãã¯ã§ã¯ãããŸããã
- ICode ããã¯ãã¬ã€ã¡ãŒã«ãŒã®é¡äŒŒç©ã§ãããå®éã«ã¯ã¹ããŒããã·ã³ã§ããããŸãã
芪æãªãèªè ã®çããã«ãé¡ãããæ¹æ³ã¯ãããŸããïŒ 1ã€ã ããèŠã€ããŠãã·ã¹ãã ãäœæããŸãããããããå®è¡ããŸãããããã®ãã¹ã¯éåžžã«é·ãåä»ã§ããã
æ¹æ³
Unity3Dã®ããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒçšã®ãã©ã°ã€ã³ãéçºãããšããã¢ã€ãã¢ã¯ãããªãåã«çãŸããŸããã æåã¯ããããããªããããã¯ã¯ãŒã«ã ãšæã£ãŠããŸããã ãããã®èãã¯ãå€ãã®åæ§ã®ã²ãŒã ããããéåžžã«è¿ éã«è¡ãå¿ èŠã®ãã20ãè¶ ããäœåããããããžã§ã¯ãã«åãçµãéçšã§çŸããŸããã æåã®å®è£ ã¯ã€ã³ã¿ãŒãã§ãŒã¹ã®ç¹ã§ã²ã©ããã®ã§ãããããã¡ãããããã«ãã£ãŠç¹å®ã®é床ã§ã²ãŒã å šäœãæ£åžžã«éçºããããšãã§ããŸããã
次ã®ãããžã§ã¯ãã§ã¯ãæ¬æ Œçãªããžã¥ã¢ã«ãšãã£ã¿ãäœæããããšã決å®ãããŸãããããã®çµæãçµéšãå°ãªãã£ããããå®è£ ã¯æåããããã¹ãŠãéåžžã«é ããæ¥ç¶æ°ãªã©ãã¹ã±ãŒã«ããå€ãããããäœãã©ãã§ææ¡ããããšã¯äžå¯èœã§ããïŒåç §ã¹ã¯ãªãŒã³ã·ã§ãããšæãããªãã§ãã ããïŒã
ãã®åŸãã¢ã€ãã¢ã¯ãã°ãã延æãããŸããã 以äžã®ãããžã§ã¯ãã¯ãçŽç²ãªã³ãŒãã§æ¢ã«è¡ã£ããã®ã§ããããã®ã¢ã€ãã¢ã¯ãŸã é ã«æµ®ãã³ãŸããã åŸã ã«ãéå»ã®éã¡ãèæ ®ã«å ¥ããŠãæçµçãªïŒç§ã«ã¯æããïŒããžã§ã³ãšèŠä»¶ã®ãªã¹ããäœæãããŸããã ãããŠã2017幎ã«ã次ã®ããªãŒã©ã³ã¹ãããžã§ã¯ããå®äºããåŸããã®ãã©ã°ã€ã³ã«6ã7ãæãè²»ãããŠã Asset Storeã«çœ®ãããšãè©Šã¿ãäœè£ããããšå€æããŸããïŒä»ã§ãããã Panthea VSãšåŒã°ããŸã ïŒã ãã®ãããªè€éãªãããžã§ã¯ãã§ã®äœæ¥çµéšã®èŠ³ç¹ããèŠããšãããã¯ãã¹ãŠéåžžã«ã¯ãŒã«ã§ããã 2017幎11æã§ããããããæ°ãå°ã倱ããé¢å©ããè¡ãå€ãã人çãå®å šã«å€ããŸããããããŠããµã¢ãšãã£ãºã ã«é¥ããªãããã«ããããã«ãããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒã®ãããã¯ã«ã€ããŠå¥ã®è§åºŠããèŠãããšã«ããŸããã çµæã¯uViLEd㧠ãç¡æã§æçš¿ããããšã«ããŸããã ç§ã¯ãã«ã¿ã€ã ã®å¥çŽã«çœ²åããã®ã§ãé±æ«ãšç¥æ¥ã«ä»äºãããªããã°ãªããã2018幎ãã2019幎ã®åããŸã§ãã¹ãŠããããŸããã uViLEdã¯ãRoslynã³ã³ãã€ã©ïŒCïŒ7+ïŒã®ã³ãŒãã®å®å šãªãªãã¡ã¯ã¿ãªã³ã°ã§ããPanthea VSã®å€§ããªåèã§ããããããã¹ãŠãUnity3d 2018.3ããŒãžã§ã³ããã®ã¿æ©èœããŸãã
泚 ïŒ ãã³ãã¢VSã¯ãããã€ãã®ãããžã§ã¯ãïŒç¹ã«AndroidãšiOSãç¹ã«Levã®ãã©ãã¯ãšè»ïŒãç«ã¡äžããŸãããååãšããŠãããã䜿çšããäœéšã¯æåããŸãããããšãã£ã¿ãŒãæžãããšãšãæ£ãã䜿çšããæ¹æ³ãåŠã¶ããšãå¥ã®ããšã§ãïŒ
uViLEdãšãã®äœ¿çšæ¹æ³
ã¯ããã«
ãããã£ãŠãæçµçã«äœãèµ·ãã£ãã®ããæåã«åçãèŠãŠã次ã«ç¶è¡ããŸãïŒããã«åçããããŸãïŒã
ã«åºã¥ããããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒã¯äœã§ããïŒ
ããã«ïŒ
- ã³ã³ããŒãã³ã -ããã¯ãããããã®æ©èœãå®éã«ã¯MonoBehaviourã®é¡äŒŒç©ãå®è£ ããã³ãŒãã§ããããã®å Žåã®ã¿ããã¹ãŠã®ã³ã³ããŒãã³ããLogicComponentã¯ã©ã¹ããç¶æ¿ãããŸããLogicComponentã¯ã©ã¹ã¯ScriptableObjectã§ãã
- å€æ°ã¯ãããŒã¿ïŒã«ã¹ã¿ã æ§é ãã¯ã©ã¹ãã·ãŒã³ãªããžã§ã¯ããžã®åç §ããã¬ãããã¢ã»ãããªã©ïŒãä¿åã§ããç¹å¥ãªScriptableObjectã§ãã ã³ã³ããŒãã³ãéã§ããŒã¿ãå ±æããå¿ èŠãããå Žåãã€ãŸããåã³ã³ããŒãã³ããç®çã®ã¿ã€ãã®å€æ°ãåç §ã§ããããã1ã€ã§ããå Žåãå€æ°ãå¿ èŠã§ãã
- æ¥ç¶ã¯ãäºãã®ã¡ãœãããåŒã³åºãã³ã³ããŒãã³ããæ¹æ³ãé åºãèŠèŠçã«è¡šçŸãã説æã§ãã ã³ã³ããŒãã³ãéã®é¢ä¿ã¯ãã¿ã€ãINPUT_POINTããã³OUTPUT_POINTã® 2ã€ã®å°çšãã£ãŒã«ãã䜿çšããŠæ±ºå®ãããŸãã ãªã³ã¯ã¯åžžã«ãã³ã³ããŒãã³ãã®åºåãã€ã³ãããå¥ã®ã³ã³ããŒãã³ãã®å ¥åãã€ã³ããžãšåœ¢æãããŸãã ãããã®æ¥ç¶ã¯å³å¯ã§ã¯ãããŸãããã€ãŸããããã°ã©ãã«ã¯èŠãããã³ãŒãã«ãå«ãŸããŠããŸããã ãããã¯ãšãã£ã¿ãŒã«ã®ã¿ååšããã·ãŒã³ãéå§ããããšãããžãã¯ã³ã³ãããŒã©ãŒèªäœãã³ãŒããèªèããŸãã ãããã©ã®ããã«èµ·ãããã«ã€ããŠã¯ãå¥ã®èšäºã§èª¬æããŸãã
ã³ã³ããŒãã¡ã³ãå ã®ãã¹ãŠã®ãã®ïŒã³ã³ããŒãã³ããå€æ°ãé¢ä¿ïŒãããžãã¯ã圢æããŸãã äžè¬çã«ãããã»ã©è€éãªããšã¯ãããŸãããããã°ã©ããŒã¯ã³ã³ããŒãã³ããšå€æ°ã®ã³ãŒããèšè¿°ããã²ãŒã ãã¶ã€ããŒãŸãã¯å¥ã®ïŒãŸãã¯ããããåãïŒããã°ã©ããŒ/ã¹ã¯ãªãã¿ãŒããããã®ã³ã³ããŒãã³ãããšãã£ã¿ãŒã«é 眮ããæ¥ç¶ãšãã©ã¡ãŒã¿ãŒã調æŽããããšã§ããžãã¯ã圢æããŸãã
uViLEdã®äž»ãªæ©èœ
- å€éšãœãŒã¹ïŒããŒããã©ã€ããŸãã¯ãµãŒããŒïŒããã®èµ·åãå«ããé 延ã¢ãŒãã§ã®ããžãã¯ïŒã³ã³ããŒãã³ããå€æ°ãããã³é¢ä¿ã®ã»ããïŒã®å®è¡
- ã³ã³ããŒãã³ãéã®æ¥ç¶ã®æ§æïŒåŒã³åºãé åºãã¢ã¯ãã£ãåããã³éã¢ã¯ãã£ãåïŒ
- MonoBehaviorã®åå«ãå«ãã³ã³ããŒãã³ããšä»ã®ã³ãŒãã®ç°¡åãªçµ±å
- ãšãã£ã¿ãŒã§ã®ã³ã³ããŒãã³ãã®å€èŠ³ã®ãªãŒããŒã©ã€ãïŒCustomPropertyDrawerã«é¡äŒŒïŒ
- Unity3dã€ã³ã¹ãã¯ã¿ãŒã䜿çšããã³ã³ããŒãã³ãèšå®ã®æ§æ
- ãã©ãã°ã¢ã³ãããããã¹ã¯ãªãããã¡ã€ã«ãŸãã¯ãã£ã¬ã¯ããªã䜿çšããŠãããžãã¯ã«ã³ã³ããŒãã³ããç°¡åã«è¿œå ããŸãã
- ããžãã¯ãšãã£ã¿ãŒã§ã®ã³ã³ããŒãã³ãã®ã°ã«ãŒãå
- ãšãã£ã¿ãŒã§ã®ã³ã³ããŒãã³ãã®è¡šç€ºã®èšå®ïŒå転ãæå°åãæå¹åãç¡å¹åïŒ
- ããžãã¯ãšãã£ã¿ãŒããçŽæ¥ã³ã³ããŒãã³ãã³ãŒããšãã£ã¿ãŒãéã
- ãšãã£ã¿ãŒã§ã®èµ·åäžã«ãããžãã¯ãšãã£ã¿ãŒã§ãããã°ããŒã¿ãçŽæ¥è¡šç€ºãã
- ããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒã®ã¹ã±ãŒãªã³ã°
- çªç¶ããžãã¯ã«å€æ°ã®ã³ã³ããŒãã³ããå«ãŸããŠããå Žåãéžææã«ãã©ãŒã«ã¹ãä»ããŠæ€çŽ¢ããå¯èœæ§ããããŸãïŒããã¯å€æ°ã«é©çšãããŸãïŒ
- ã³ã³ããŒãã³ããšå€æ°å€ã®éã§éä¿¡ããããã¹ãŠã®ããŒã¿ã远跡ããUnity3dãšãã£ã¿ãŒã®ã·ãŒã³èµ·åã¢ãŒãã§ã®æ®µéçãªãããã°
- MonoBehaviourã¡ãœããã®ãµããŒããšåŒã³åºãã®é åºã®èšå®ã 泚 ïŒããã§ã¯ãSOã«ã¯ããã©ã«ãã§StartãUpdateãªã©ã®ã¡ãœããã¯ãªãããšãæå³ããŸãã ãããã£ãŠããããã®ãµããŒãã¯ã³ã³ããŒãã³ãèªäœã«è¿œå ãããŠããŸãã åæã«ãExecuteOrderå±æ§ã䜿çšããŠãStartãUpdateãªã©ã®ã¡ãœãããåŒã³åºãããé åºãæ§æã§ããŸãã
- ã€ã³ã¹ãã¯ã¿ãŒã®Coroutineãasync / awaitãããã³ãã¹ãŠã®Unity3då±æ§ã®ãµããŒããããã³CustomPropertyDrawerã®ãµããŒã
ãšãã£ã¿ãŒã§äœæ¥ãã
ãšãã£ã¿ãŒã§ã®äœæ¥ãéå§ããã«ã¯ãã·ãŒã³ãéããŠãããšãã£ã¿ãŒèªäœãèµ·åããå¿ èŠããããŸãã
ãšãã£ã¿ãŒãèµ·åããåŸãã·ãŒã³ïŒãšãã£ã¿ãŒã®æŽæ°ãã¿ã³ïŒãåæåããŸãããã®åŸãæ¢åã®ããžãã¯ãäœæãŸãã¯ã·ãŒã³ã«è¿œå ã§ããŸãã
ããžãã¯ïŒã³ã³ããŒãã³ãããããã®ãã©ã¡ãŒã¿ãŒãã³ã³ããŒãã³ãéã®é¢ä¿ãå€æ°ãããã³ãããã®å€ãèšè¿°ãããã¡ã€ã«ïŒãäœæããåŸããããæå³ã§åããããšãã§ããŸãã ã³ã³ããŒãã³ããŸãã¯å€æ°ãè¿œå ããã«ã¯ã察å¿ããã¹ã¯ãªãããããžãã¯ãšãã£ã¿ãŒã®é åã«ãã©ãã°ããã ãã§ãã å¥ã®ãªãã·ã§ã³ã¯ã ComponentDefinitionå±æ§ã䜿çšããŠèªåçã«çæããããã£ã¬ã¯ããªã䜿çšããããšã§ãã
ããžãã¯ã«ããã€ãã®ã³ã³ããŒãã³ããè¿œå ããåŸãã°ã«ãŒããå«ããŠç§»åããããèŠèŠçãªã°ã«ãŒãã«çµåãããã§ããŸãã
ããžã¥ã¢ã«ãšãã£ã¿ã§ã³ã³ããŒãã³ãèªäœãè¡šããã®ãããã«è©³ããèããŠã¿ãŸãããã
ããã«ïŒ
- ã³ã³ããŒãã³ãã®ã¡ãã¥ãŒãã¿ã³ãã¯ãªãã¯ãããšã次ã®ããšãã§ããããããããŠã³ã¡ãã¥ãŒãéããŸãã
- ã³ã³ããŒãã³ããæå¹åãŸãã¯ç¡å¹åãã
- ã³ã³ããŒãã³ããæå°åããïŒããã¯ããããŒãããã«ã¯ãªãã¯ããããšã§ãå®è¡ã§ããŸãïŒ
- ã³ã³ããŒãã³ãã®å転ïŒå ¥åãã€ã³ããšåºåãã€ã³ããå ¥ãæ¿ããïŒ
- ã³ã³ããŒãã³ããªãã·ã§ã³é åã®é衚瀺ãŸãã¯è¡šç€º
- ã³ã³ããŒãã³ãã®ã³ãŒããšãã£ã¿ãŒãéããŸã
- ã³ã³ããŒãã³ããã©ã¡ãŒã¿ã®é åã¯ãã³ã³ããŒãã³ãã®ããŒãã©ã¡ãŒã¿ã®å€ã衚瀺ãããå Žæã§ããããã®æ§æã¯ããã°ã©ããŒã«äŸåããŸã
ãã©ã¡ãŒã¿ãŒïŒãããªãã¯ãã£ãŒã«ããŸãã¯SerializeFieldå±æ§ãæã€ãã£ãŒã«ãïŒãæ§æããã«ã¯ãããžãã¯ãšãã£ã¿ãŒã§ã³ã³ããŒãã³ããéžæããUnity3dã€ã³ã¹ãã¯ã¿ãŒãéãå¿ èŠããããŸãã
ããã«ïŒ
- å³äžé ã«ã¯ãããžãã¯ãšãã£ã¿ãŒã«è¡šç€ºãããããããŒã®è²ãå€æŽã§ãããã¿ã³ããããŸã
- åå -ã³ã³ããŒãã³ãã€ã³ã¹ã¿ã³ã¹ã®ååãèšå®ãããã£ãŒã«ã
- ã³ã¡ã³ã -ã³ã³ããŒãã³ãã€ã³ã¹ã¿ã³ã¹ã«ã³ã¡ã³ããèšå®ããããã®ãã£ãŒã«ã;ã³ã³ããŒãã³ãã«ã«ãŒãœã«ãåããããšãããžãã¯ãšãã£ã¿ãŒã«è¡šç€ºãããŸã
- ã³ã³ããŒãã³ããã©ã¡ãŒã¿ -ã³ã³ããŒãã³ããã©ã¡ãŒã¿ã衚瀺ãããé åïŒãããªãã¯ãã£ãŒã«ãããã³SerializeFieldã§ããŒã¯ããããã£ãŒã«ãïŒ
- å€æ°ãªã³ã¯ -å€æ°ãžã®åç §ãèšå®ããããã®é åïŒå€æ°ã®è©³çŽ°ã«ã€ããŠã¯ãå€æ°ã®æäœã«é¢ããã»ã¯ã·ã§ã³ã§èª¬æããŸãïŒã
ãªããžã§ã¯ããèŠèŠçã«ã°ã«ãŒãåããã«ã¯ããªããžã§ã¯ããéžæããŠãããå³ãã¿ã³ãæŒããŠã¡ãã¥ãŒå ã®å¯Ÿå¿ããã¢ã€ãã ãéžæããå¿ èŠããããŸãã ã°ã«ãŒãã®ååãå€æŽããããé è²ãå€æŽãããã§ããŸãã
ã³ã³ããŒãã³ãã®èŠèŠçè¡šçŸãã¹ã±ãŒãªã³ã°ããã«ã¯ãããŠã¹ãã€ãŒã«ã䜿çšããŸããããã§ã¯ãã¹ãŠãéåžžã«ç°¡åã§ãã
ãããŠãæåŸã«æ³šæãããã®ã¯ãã³ã³ããŒãã³ãéã®æ¥ç¶ã®æäœã§ãã
éä¿¡ã確ç«ããã«ã¯ãããã³ã³ããŒãã³ãã®åºåãã€ã³ããå¥ã®ã³ã³ããŒãã³ãã®å ¥åãã€ã³ãã«æ¥ç¶ããå¿ èŠããããŸãã
é¢ä¿ã¯ããã€ã³ããéåä¿¡ããã¿ã€ããããã³ã°ã«ãŒã«ã«åºã¥ããŠç¢ºç«ãããŸãã ããŒã¿ãåä¿¡ããªãå ¥åãã€ã³ãã«å¯ŸããŠäŸå€ãäœæãããä»»æã®åºåãã€ã³ããæ¥ç¶ã§ããŸãã æ¥ç¶ã確ç«ããããšãã·ã¹ãã ã¯ã¿ã€ãã®äžèŽãèªåçã«ãã§ãã¯ãããã®æ¥ç¶ã確ç«ã§ãããã©ããã衚瀺ããŸãã å ¥åããã³åºåãã€ã³ãã¯ã次ã®ã¯ã©ã¹ã䜿çšããŠã³ã³ããŒãã³ãã³ãŒãã§èšå®ãããŸãã
INPUT_POINT OUTPUT_POINT INPUT_POINT<T> OUTPUT_POINT<T>
æåã®2ã€ã®ã¯ã©ã¹ã¯ãã©ã¡ãŒã¿ãŒãåãå ¥ããªãå ¥åãã€ã³ããšåºåãã€ã³ãã«äœ¿çšããã2çªç®ã®ã¯ã©ã¹ã¯ãããããã©ã¡ãŒã¿ãŒãåãå ¥ããŸããã Tã¯ã©ã®ã¿ã€ãã§ãããŸããŸããã
public INPUT_POINT <float> InputFloatValue = new INPUT_POINT<float>(); public OUTPUT_POINT <float> OutputFloatValue = new OUTPUT_POINT<float>();
ãªã³ã¯ã®ãã§ãŒã³ãåŒã³åºãã«ã¯ãå®è¡æ©èœã䜿çšããå¿ èŠããããŸãã
OutputFloatValue.Execute(5f);
ãã®ãããªåŒã³åºããåŠçããã«ã¯ãã³ã³ããŒãã³ãã³ãŒãã®å ¥åãã€ã³ãã®ãã³ãã©ãŒãèšå®ããå¿ èŠããããŸãïŒå°ãåŸã§æ£ç¢ºã«è©±ãå Žæã«ã€ããŠïŒã
InputFloatValue.Handler = value => Debug.Log(value);
ãããŠæåŸã«ãæ¥ç¶ã«é¢ããéèŠãªãã€ã³ãã«èšåããããšæããŸãã 1ã€ã®ãã€ã³ãããè€æ°ã®ãªã³ã¯ãããå Žåã¯ããšãã£ã¿ãŒã§åŒã³åºãã®é åºã調æŽã§ããŸãã
å€æ°ãæäœãã
åè¿°ã®ããã«ãå€æ°ã¯ããªã³ã¯ãä»ããŠã³ã³ããŒãã³ãéã§ããŒã¿ãå ±æã§ããç¹å¥ãªãªããžã§ã¯ãã§ãã ã³ã³ããŒãã³ããªã©ã®å€æ°ã¯ãããã°ã©ããŒã«ãã£ãŠäœæãããŸãã
[ComponentDefinition(Name = "Float", Path = "uViLEd Components/Base/Variable/Base", Tooltip = "Variable for a floating-point number", Color = VLEColor.Cyan)] public class VariableFloat : Variable<float> { }
ã芧ã®ãšãããå€æ°ã®åºæ¬ã¯ã©ã¹ã¯ãžã§ããªãã¯ã¯ã©ã¹Variableã§ããããã§ãTã¯å€æ°ã§å²ãŸããããŒã¿ã®åã§ãããTã¯ã·ãªã¢ã«åã§ããä»»æã®åã§ãã
ãšãã£ã¿ãŒã§ã¯ãå€æ°ã¯æ¬¡ã®ããã«è¡šç€ºãããŸãã
å€æ°å€ã®è¡šç€ºãå€æŽããã«ã¯ãTåã®ToStringã¡ãœãããåå®çŸ©ããã ãã§ãã
public struct CustomData { public readonly int Value01; public readonly int Value02; public CustomData (int value01, int value02) { Value01= value01; Value02= value02; } public override string ToString() { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Value01 = {0}".Fmt(Value01)); stringBuilder.Append("Value02 = {0}".Fmt(Value02)); return stringBuilder.ToString(); } }
ãããã£ãŠããã®ã¿ã€ãã®å€æ°ã¯æ¬¡ã®ããã«ãªããŸãã
public class VariableCustomData : Variable<CustomData> { }
ã³ã³ããŒãã³ãã®å€æ°ãžã®åç §ãè¿œå ããã«ã¯ãç¹å¥ãªã¯ã©ã¹ã䜿çšããå¿ èŠããããŸãã
public VARIABLE_LINK<CustomData> CustomVariableLink = new VARIABLE_LINK<CustomData>();
ãã®åŸããªã³ã¯ã¯ã€ã³ã¹ãã¯ã¿ãŒã§èšå®ã§ããããããããŠã³ã¡ãã¥ãŒã«ã¯CustomDataã¿ã€ãã®å€æ°ã®ã¿ã衚瀺ãããããããããã®æäœãå€§å¹ ã«ç°¡çŽ åãããŸãã
å€æ°ãæäœããããã«ãå€æ°ã®å€ããã€å€æŽãããã®ãããŸãã¯ãã€ããŒã¿ãèšå®ãããã®ããå€æããç¹å¥ãªæ¹æ³ããããŸãã
CustomVariableLink.AddSetEventHandler(CustomDataSet); CustomVariableLink.AddChangedEventHandler(CustomDataChanged);
Changedã¯Equalsæ¡ä»¶ã«ãã£ãŠæ©èœãããããæ§é ãšã¯ã©ã¹ã䜿çšããå Žåã¯ããã®ã¡ãœãããåå®çŸ©ããŠæ£ããåäœã確ä¿ããå¿ èŠãããããšã«çæããŠãã ããã
Unityãªããžã§ã¯ãã®äœ¿çš
uViLEdã·ã¹ãã ã®æ©èœã«ãããUnityãªããžã§ã¯ããžã®çŽæ¥ãªã³ã¯ã¯ãããžãã¯ã®ããŒãæã«åŸ©å ã§ããªããããã·ã¹ãã å ã§äœ¿çšã§ããŸããã ãã®åé¡ã解決ããããã«ãå°çšã®VLObjectã·ã§ã«ãäœæãããŸãããããã«ããããã®ãããªãªã³ã¯ãäœæãããããªã³ã¯ãä¿åããã³ããŒããããã§ããŸãã ãšãããããã®ã·ã§ã«ã«ã¯ç¹å¥ãªããããã£ãšãã£ã¿ããããããã䜿çšãããšãã·ãŒã³å ã®ä»»æã®ãªããžã§ã¯ãããã³ã³ããŒãã³ããååŸã§ããŸãïŒäžå³ãåç §ïŒã VLObjectã䜿çšãããšãã·ãŒã³ãªããžã§ã¯ããšãã®ã³ã³ããŒãã³ããžã®ãªã³ã¯ã ãã§ãªãããã¬ããããã¯ã¹ãã£ããµãŠã³ããªã©ã®ãªãœãŒã¹ãã¡ã€ã«ãžã®ãªã³ã¯ãä¿åã§ããŸãã
泚 ïŒæ¢åã®ããžãã¯ãå¥ã®ã·ãŒã³ã§äœ¿çšãããå Žåãã·ãŒã³ã¯ã¹ãã¬ãŒãžãšããŠæ©èœããããããã¬ãããžã®åç §ãå«ããªããžã§ã¯ããžã®åç §ã¯å€±ãããŸãã ããžãã¯ããã³ãã¬ãŒããšããŠäœ¿çšããå Žåã¯ããããèæ ®ããå¿ èŠããããŸãããã®å Žåãæé©ãªãªãã·ã§ã³ã¯ãå€éšããïŒããšãã°ãã·ãŒã³ã«ã¢ã¿ãããããããžãã¯ããïŒå¿ èŠãªãªã³ã¯ã転éããããšã§ãã
VLObjectã«ã€ã³ã¹ããŒã«ãããUnityãªããžã§ã¯ãã®ã¿ã€ããå¶éããããšãã§ããŸãã ããã¯Unityã€ã³ã¹ãã¯ã¿ãŒã®ã¿ã«åœ±é¿ããããããæäœããããã«äœ¿çšãããŸãã
[SerializeField] [TypeConstraint(typeof(Button))] private VLObject _button;
è«çã³ã³ããŒãã³ãã®äœæ
ããžãã¯ã³ã³ããŒãã³ããäœæããã«ã¯ãããã°ã©ãããããžã§ã¯ãã«åçŽãªCïŒã¹ã¯ãªãããã¡ã€ã«ãè¿œå ãïŒ[ãããžã§ã¯ã]ã¿ãã®ç¹å¥ãªã¡ãã¥ãŒããã³ã³ããŒãã³ããŸãã¯å€æ°ãããã«äœæããããšãã§ããŸãïŒããã®ã³ãŒãã次ã®ããã«å€æŽããã ãã§ååã§ãïŒ
[ComponentDefinition(Name = "MyComponent", Path = "MyFolder/MySubfolder", Tooltip = "this my logic component", Color = VSEColor.Green)] public class MyLogicComponent : LogicComponent { }
åè¿°ããããã«ã ComponentDefinitionã¯ã³ã³ããŒãã³ãã®ã«ã¿ãã°ãèªåçã«äœæã§ããå±æ§ã§ããããã§ã¯ãæååã§HEX圢åŒãšããŠè²ïŒããããŒã®è²ïŒãæå®ãããŠããããšã«æ³šæããå¿ èŠããããŸãã
LogicComponentã¯ãã¹ãŠã®ã³ã³ããŒãã³ãã®åºæ¬ã¯ã©ã¹ã§ãããããã¯ScripatableObjectã®åå«ã§ãã
以äžã¯ãboolåã®å ¥åå€ã«ãã£ãŠåå²ããã³ã³ããŒãã³ãã®ç°¡åãªäŸã§ãã
public class IfBool : LogicComponent { public INPUT_POINT<bool> ValueToBeChecked = new INPUT_POINT<bool>(); public OUTPUT_POINT True = new OUTPUT_POINT(); public OUTPUT_POINT False = new OUTPUT_POINT(); public override void Constructor() { ValueToBeChecked.Handler = ValueToBeCheckedHandler; } private void ValueToBeCheckedHandler(bool value) { if(value) { True.Execute(); }else { False.Execute(); } } }
ãã®ãããã³ãŒããããããããã«ãã³ã³ããŒãã³ãã®å ¥åãã€ã³ããäœæããŸãããããã¯ãboolåã®å€ãšãååŸããå€ã«å¿ããŠåŒã³åºããã2ã€ã®åºåãã€ã³ããåããŸãã
ããããããªãã¯ä»ãã©ã®ãããªã³ã³ã¹ãã©ã¯ã¿ãŒã§ããïŒ èª¬æããŸãã ããã©ã«ãã§ã¯ã ScriptableObjectã¯Start ã Updateãªã©ã®ã¡ãœããããµããŒãããŠããŸãããã Awake ã OnEnable ã OnDisableãããã³OnDestroyããµããŒãããŠããŸãã ãã®ããã CreateInstanceã¡ãœããã䜿çšããŠScriptableObjectãäœæãããå Žåãåžžã«ç®èŠã ïŒ OnEnableãªã© ïŒãåŒã³åºãããŸãããå®éã«ã¯ãããåé¡ã§ãã ãšãã£ã¿ãŒã¢ãŒãã§ã®ã·ãªã¢ã«åã®ããã«ãªããžã§ã¯ããã¡ã¢ãªã«äœæããããšããäºå®ã«ããããã®æç¹ã§ã³ã³ããŒãã³ãã³ãŒããåäœããé€å€ããå¿ èŠããã£ãããã Constructorã¡ãœãããšããŠAwakeã¢ããã°ãè¿œå ãããŸãããããã¯ããšãã£ã¿ãŒã§ãªããžã§ã¯ããåé€ãããšãã®OnDisableã¡ãœãããšOnDestroyã¡ãœããã«ãåœãŠã¯ãŸããŸãã ã³ã³ããŒãã³ãã®åé€ãæ£ããåŠçããå¿ èŠãããå ŽåïŒããšãã°ãã·ãŒã³ãã¢ã³ããŒãããå ŽåïŒã IDisposableã€ã³ã¿ãŒãã§ã€ã¹ã䜿çšããå¿ èŠããããŸãã
äžè¬ã«ãã芧ã®ãšãããã³ã³ããŒãã³ããäœæããã®ã«é£ããããšã¯äœããããŸããã ããã¯éåžžã®ã¯ã©ã¹ã§ãä»»æã®ã³ãŒããå«ããããšãã§ããŸãã ç¹å®ã®ã±ãŒã¹ã§ã¯ãã³ã³ããŒãã³ãã«ã¯å ¥åãã€ã³ããšåºåãã€ã³ãããŸã£ããå«ãŸããªãå ŽåããããŸãããã°ããŒãã«ã¡ãã»ãŒãžã䜿çšããŠéä¿¡ããŸãã ã¡ãªã¿ã«ããã®ããã«ã uViLEdã«ã¯GlobalEventã¯ã©ã¹ããããŸã-ããã¯ããŒã¿åã«åºã¥ããã¡ãã»ãŒãžã·ã¹ãã ã§ãïŒè©³çŽ°ã«ã€ããŠã¯ç§ã®èšäºãåç §ããŠãã ããïŒã
æåŸã«èšåãããã®ã¯ãã³ã³ããŒãã³ãã®ãã©ã¡ãŒã¿ãŒã«å¿ããŠã³ã³ããŒãã³ãã®å ¥åãã€ã³ããšåºåãã€ã³ããæ§æããæ©èœã§ãã
ãããè¡ãã«ã¯ãã³ã³ããŒãã³ãã³ãŒãã§ã IInputPointParseããã³IOutputPointParseã€ã³ã¿ãŒãã§ã€ã¹ã®äžæ¹ãŸãã¯äž¡æ¹ãå®è£ ããã ãã§ååã§ãã 以äžã¯ã Switchãã©ã³ãã³ã³ããŒãã³ãã®æœè±¡ãžã§ããªãã¯ã¯ã©ã¹ã³ãŒãã®äŸã§ã; SwitchValuesãã©ã¡ãŒã¿ãŒã«å¿ããŠãåºåãã€ã³ãã¯ããã§èªåçã«çæãããŸãã
SwitchAbstractã¯ã©ã¹ã³ãŒã
public abstract class SwitchAbstract<T> : LogicComponent, IOutputPointParse { [Tooltip("input point for transmitting value, which should be checked")] public INPUT_POINT<T> ValueToBeChecked = new INPUT_POINT<T>(); [Tooltip("set of values for branching")] public List<T> SwitchValues = new List<T>(); protected Dictionary<string, object> outputPoints = new Dictionary<string, object>(); public override void Constructor() { ValueToBeChecked.Handler = ValueToBeCheckedHandler; } protected virtual bool CompareEqual(T first, T second) { return first.Equals(second); } protected virtual string GetValueString(T value) { var outputPontName = value.ToString(); #if UNITY_EDITOR if (!UnityEditor.EditorApplication.isPlaying) { if (outputPoints.ContainsKey(outputPontName)) { outputPontName += " ({0})".Fmt(outputPoints.Count); } } #endif return outputPontName; } private void ValueToBeCheckedHandler(T checkedValue) { foreach (var value in SwitchValues) { if (CompareEqual(checkedValue, value)) { ((OUTPUT_POINT)outputPoints[GetValueString(value)]).Execute(); return; } } } public IDictionary<string, object> GetOutputPoints() { #if UNITY_EDITOR if (!UnityEditor.EditorApplication.isPlayingOrWillChangePlaymode) { outputPoints.Clear(); } #endif if (outputPoints.Count == 0) { foreach (var value in SwitchValues) { outputPoints.Add(GetValueString(value), new OUTPUT_POINT()); } } return outputPoints; } }
è«çãããã°
UViLEdã¯ãããžãã¯ããããã°ããããã®ããã€ãã®ã¡ã«ããºã ãæäŸããŸãã
- ã·ãŒã³èµ·åã¢ãŒãã®ããžãã¯ãšãã£ã¿ãŒã§å éšå€æ°ãšãã®å€ã衚瀺ããæ©èœã ãããè¡ãã«ã¯ã ViewInDebugModeå±æ§ã䜿çšããŸã
- ã·ãŒã³èµ·åã¢ãŒãã§è«çå€æ°ã®å€ã衚瀺ããæ©èœ
- ã³ã³ããŒãã³ãéã®åŒã³åºãã®æ®µéçãªãããã°ãšãã³ã³ããŒãã³ãéã§è»¢éãããããŒã¿ã®è¡šç€ºã®å¯èœæ§
UViLEdã«ã¯ãæåŸã®ã¢ã€ãã çšã®ç¹å¥ãªã¢ãŒãããããã·ãŒã³ã®éå§æã«ãªã³ã«ãªããŸãã
æ®å¿µãªããããã®ã¢ãŒãã«ã¯ãã·ãŒã³éã®ç§»è¡ã«é¢é£ããç¹å®ã®å¶éããããŸãã ãã®å Žåãåã®ã·ãŒã³ãšããžãã¯ããã®ãããã°ããŒã¿ã¯å€±ãããæ°ãããã®ã§ã¯ãããžãã¯ããšãã£ã¿ãŒã§ã¢ã¯ãã£ãã«ãªã£ãç¬éããã®ã¿è¡šç€ºããå§ããŸãã
ãããã«
ãã®èšäºã§ã¯ãçŸåšã®ãããžã§ã¯ãã§äœ¿çšããŠããéçºã¢ãããŒããç°¡åã«çŽ¹ä»ããããšããŸããã æåã®æçè«ïŒç§ã®ãã®ãå«ãïŒã«ãããããããç¹ã«ãããã¿ã€ãã³ã°ã®å Žåãå®è·µã¯ãã®äœ¿çšã®å©äŸ¿æ§ãèãã瀺ããŠããŸãã ãšããããã²ãŒã ãã¶ã€ããŒã®äœæ¥ã¯å€§å¹ ã«ç°¡çŽ åãããŠãããã·ãŒã³ã«ã蟌ãŸãããªããžã§ã¯ããçªããŠã²ãŒã ãã¬ã€ãã«ã¹ã¿ãã€ãºããããå€æ°ãã³ã³ããŒãã³ãã®ããŒã¿ã®ã»ããã§ãã¹ãŠãç°¡åã«æ§æã§ããåå¥ã®ããžãã¯ãäœæããããããŸããã ãŸãã倧ããªå©ç¹ã¯ãç§ã®ãããžã§ã¯ãã§ã¯ãã³ã³ãã³ããå€éšããããŠã³ããŒããããããšãå€ããšããäºå®ã§ãã ããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒã䜿çšãããšãã¡ã€ã³ã¢ããªã±ãŒã·ã§ã³ãæŽæ°ããã«ã²ãŒã ããã»ã¹ã®ãã©ã³ã¹ãæŽæ°ã§ããŸããå Žåã«ãã£ãŠã¯ãããžãã¯èªäœãå€æŽã§ããŸãã
ç§èªèº«ã¯ããã®ãããªéçºã¢ãããŒãã¯å€§èŠæš¡ãªãããžã§ã¯ãã«ã¯é©çšã§ããªããããã¡ãããäžçã掻æ§åããããã®ã²ãŒã ãã¬ã€ã¹ã¯ãªãããã¬ãã«ãã¶ã€ã³ãªã©ã«äœ¿çšã§ãããšèããŠããŸããçŸåšé²è¡äžã®ãããžã§ã¯ãïŒåäŸã®ã»ã°ã¡ã³ãïŒããããŸã§ã®ãšããã圌ã¯çŽ æŽãããçµæã瀺ããŠããŸãã
次ã¯ïŒ
ããã¯ãããžãã¯uViLEdã®ããžã¥ã¢ã«ãšãã£ã¿ãŒã«é¢ããäžé£ã®èšäºã®æåã®éšåã§ãããã次ã®éšåããããŸãã
- ã·ã¹ãã ã®ã³ã¢ ïŒããžãã¯ã®ããŒããçºçããæ¹æ³ãScriptableObjectãéžæãããçç±ãAPIãã©ã®ããã«é 眮ãããããã©ã®ããã«å®è¡ã§ããããªã©ãã©ã®ãããªå°é£ãçãããã¹ãŠã解決ããããã
- ç·šéè ïŒã©ã®ããã«éçºãããã®ããã©ã®ããã«æ§ç¯ãããã®ããã©ã®ãããªåé¡ãšè§£æ±ºçãªã©ãä»ç§ãäœãçŽããã®ã
åŸç¶ã®èšäºã§èª¬æãããå ·äœçãªè³ªåãããå Žåã¯ãã³ã¡ã³ããèšå ¥ããŠãã ããã
PS ïŒ uViLEdã®éèŠãªãã€ã³ãã«ã€ããŠè©±ãããšããŸããã ãå¿ èŠã«å¿ããŠãAsset Storeãããã©ã°ã€ã³ãããŠã³ããŒãããããšã§ããã«æ £ããããšãã§ããŸããå®å šãªããã¥ã¡ã³ãïŒè±èªã§ããïŒïŒãŠãŒã¶ãŒã¬ã€ããããã°ã©ããŒããã³APIã®ã¬ã€ãããããŸãã
UViLEdããžã¥ã¢ã«ããžãã¯ãšãã£ã¿ãŒ
ã°ããŒãã«ã¡ãã»ãŒãžã³ã°èšäº