Unity¤Ë´ØÏ¢¤¹¤ëµ­»ö¤Ç¤¹

¡¡Á°²ó¤Ë³¤¤¤Æ¡¢ReactivePropery ¤ò³èÍѤ·¤¿½èÍý¤Î¼ÂÁõ¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡
¡¡¤³¤³¤Ç¤Ï GameManager ¥¯¥é¥¹¤È¡¢CharaDetail ¥¯¥é¥¹¤Î½èÍý¤ò½çÈ֤˸«Ä¾¤·¤Æ¤¤¤­¤Þ¤¹¡£


¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯


¡¡°Ê²¼¤ÎÆâÍƤǽçÈ֤˼ÂÁõ¤ò¿Ê¤á¤Æ¤¤¤­¤Þ¤¹¡£

ȯŸ£´¡¡¡ÝUniRX (ReactivePropery)¤òÍøÍѤ·¤¿½èÍý¤Î¼ÂÁõ­£¡Ý
£¶¡¥¥¯¥é¥¹´Ö¤Î°Í¸´Ø·¸¤Î¸«Ä¾¤·­£¡¡¡¼GameManager ¥¯¥é¥¹¤È CharaDetail ¥¯¥é¥¹¡¼



¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£

¡¡¡¦UniRX ¤Î´ðËÜÆ°ºî­¢¡¡¡¼AddTo ¥á¥½¥Ã¥É¡¼



£¶¡¥¥¯¥é¥¹´Ö¤Î°Í¸´Ø·¸¤Î¸«Ä¾¤·­£¡¡¡¼GameManager ¥¯¥é¥¹¤È CharaDetail ¥¯¥é¥¹¡¼

£±¡¥Àß·×


¡¡¤¤¤Þ¤Þ¤Ç¼ÂÁõ¤·¤Æ¤­¤¿¼ê½ç¤ÈƱ¤¸¤Ç¤¹¡£
¡¡¶µºà¤Î½èÍý¤ò¸«¤ëÁ°¤Ë¡¢°Í¸´Ø·¸¤ò²ò¾Ã¤¹¤ë¤Ë¤Ï¤É¤¦¤¹¤ì¤Ð¤¤¤¤¤Î¤«¡¢
¼«Ê¬¤ÇÀ߷פò¹Í¤¨¤Æ¡¢ReactivePropery ¤òÍøÍѤ·¤¿½èÍý¤ÎÀ߷פËÊѹ¹¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£



¡¡GameManager ¥¯¥é¥¹¤È¡¢¤½¤Î¾¤Î¥¯¥é¥¹¤È¤Î´Ö¤Î°Í¸´Ø·¸¤Ë¤Ä¤¤¤Æ¹Í¤¨¤Æ¡¢²ò¾Ã¤Ç¤­¤ëÉôʬ¤Ë¤Ä¤¤¤Æ¤Ï°Í¸´Ø·¸¤ò²ò¾Ã¤·¤Æ¡¢¥¯¥é¥¹¤ÎÆÈΩÀ­¤ò¹â¤á¤Þ¤¹¡£

¡¡¸½ºß¤Î GameManager ¥¯¥é¥¹¤È CharaDetail ¥¯¥é¥¹¤Î´Ø·¸¤ò¸«¤Æ¤¤¤­¤Þ¤¹¡£

¡ã¥¯¥é¥¹´Ö¤Î°Í¸´Ø·¸¡ä
¡¡GameManager ¥¯¥é¥¹¡¡¢Î¡¡CharaDetail ¥¯¥é¥¹

¡¡GameManager ¥¯¥é¥¹¤Ï¡¢CharaDetail ¥¯¥é¥¹¤ò¥×¥ì¥Õ¥¡¥Ö¤Î¾ðÊó¤È¤·¤Æ´ÉÍý¤·¤Æ¤ª¤ê¡¢¥¤¥ó¥¹¥¿¥ó¥¹¤¹¤ë½èÍý¤òôÅö¤·¤Æ¤¤¤Þ¤¹¡£
¤½¤ÎºÝ¤Ë¡¢CharaDetail ¥¯¥é¥¹¤Î SetUpCharaDetail ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤·¡¢GameManager ¥¯¥é¥¹¤Î¾ðÊó¤òÄ󶡤·¤Æ¤¤¤Þ¤¹¡£

¡¡¤½¤Î¤¿¤á¤³¤ì¤Ï¡¢¤ª¸ß¤¤¤¬¤ª¸ß¤¤¤òÃΤäƤª¤ê¡¢¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤ë¡¢°Í¸¤·¤Æ¤¤¤ë´Ø·¸¤Ç¤¢¤ë¤È¸À¤¨¤Þ¤¹¡£
¤³¤Î´Ø·¸¤ò¡¢²¼µ­¤Î¤è¤¦¤Ë GameManager ¥¯¥é¥¹¤Î¤ß¤¬ÃΤäƤ¤¤ë¡¦¤Ä¤Ê¤¬¤Ã¤Æ¤¤¤ë¾õÂ֤˽¤Àµ¤·¤Þ¤¹¡£

¡ã¤ä¤ê¤¿¤¤¤³¤È¡¡¤½¤Î­¡¡ä
¡¡GameManager ¥¯¥é¥¹¡¡¢ª¡¡CharaDetail ¥¯¥é¥¹(GameManager ¥¯¥é¥¹¤À¤±¤¬ CharaDetail ¥¯¥é¥¹¤òÃΤäƤ¤¤ë)



¡¡º£²ó¤Î¼ÂÁõ¤âÁ°²ó¤ÈƱ¤¸¤è¤¦¤Ë¹Í¤¨¤Þ¤¹¡£
¤¤¤Þ¤Þ¤Ç¤Ï°Í¸¤·¤¢¤Ã¤Æ¤¤¤¿¥¯¥é¥¹¤òÊÒÊý¤À¤±¤¬Áê¼ê¤Î¥¯¥é¥¹¤Î¤³¤È¤òÃΤäƤ¤¤ë¾õÂ֤˺î¤êÊѤ¨¤Þ¤¹¡£

¡¡¤Þ¤º¤Ï CharaDetail ¥¯¥é¥¹¤ÎÆÈΩÀ­¤ò¹â¤á¤Æ¡¢GameManager ¥¯¥é¥¹¤Î¤³¤È¤ò¡ÖÃΤé¤Ê¤¤¡×¾õÂ֤ˤ·¤Þ¤¹¡£
¤½¤ÎÂå¤ï¤ê¤Ë¡¢ReactivePropery ¤ò½àÈ÷¤·¤Æ¡¢TapPointDetail ¥¯¥é¥¹¤ÇȯÀ¸¤·¤¿¾õÂÖ¤ò³°Éô¤Î¥¯¥é¥¹¤ËÄÌÃΤǤ­¤ë¾õÂÖ¤ËÊѤ¨¤Þ¤¹¡£

¡¡¤½¤·¤Æ¡¢GameManager ¥¯¥é¥¹¤Ç¤Ï CharaDetail ¥¯¥é¥¹¤Î¾ðÊó¤ò ReactivePropery ¤òÄ̤¸¤ÆÃΤë(´Æ»ë)¤¹¤ë¤è¤¦¤ËÊѹ¹¤ò¹Ô¤¤¤Þ¤¹¡£


£²¡¥CharaDetail ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤¹¤ë


¡¡GameManager ¥¯¥é¥¹¤Î¾ðÊó¤òÍøÍѤ·¤Ê¤¤¾õÂ֤Ǻ£¤Þ¤Ç¤ÈƱ¤¸µóÆ°¤Ë¤Ê¤ë¤è¤¦¤Ë¡¢¥¯¥é¥¹¤ÎÆâÍƤòÀßÄꤷ¤Ê¤ª¤·¤Æ¡¢¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤ò¹Ô¤¤¤Þ¤¹¡£

¡¡¿·¤·¤¯ ReactivePropery ¤òÄɲä·¡¢¤³¤Î¾ðÊó¤ò GameManager ¥¯¥é¥¹Â¦¤Ç´Æ»ë¤·¤Æ¡¢
Ãͤι¹¿·¤Ë¹ç¤ï¤»¤Æ GameManager ¥¯¥é¥¹Â¦¤Ç¼«Æ°Åª¤Ë½èÍý¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£

¡¡¸½ºß¤Ï SetUpCharaDetail ¥á¥½¥Ã¥É¤Î°ú¿ô¤Ç GameManager ¥¯¥é¥¹¤È TapPointDetail ¥¯¥é¥¹¤Î¾ðÊó¤ò¼õ¤±¼è¤Ã¤Æ¡¢
GameManager ¥¯¥é¥¹¤È CharaDetail ¥¯¥é¥¹¤È¤Ï¤ª¸ß¤¤¤ËÃΤäƤ¤¤ë¾õÂ֤ˤʤäƤ¤¤Þ¤·¤¿¤¬¡¢¤½¤ì¤ò²ò¾Ã¤·¤Þ¤¹¡£
TapPointDetail ¥¯¥é¥¹¤Î¾ðÊó¤â¤½¤Î GameManager ¥¯¥é¥¹¤Ø¤ÎÌ¿Îá¤ÎºÝ¤ËÍøÍѤ·¤Æ¤¤¤¿¾ðÊó¤Ç¤¢¤ë¤¿¤á¡¢¥¯¥é¥¹¤È¼Â¹ÔÌ¿Îá¤Î¤É¤Á¤é¤âÉÔÍפˤʤê¤Þ¤¹¡£

¡¡¤Þ¤¿¿·¤·¤¯¥³¡¼¥ë¥Ð¥Ã¥¯¤Î¥á¥½¥Ã¥É¤Ç¤¢¤ë OnDestroy ¥á¥½¥Ã¥É¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£
¤³¤Î¥á¥½¥Ã¥É¤Ï MonoBehaviour ¥¯¥é¥¹¤¬»ý¤Ã¤Æ¤¤¤ë¥á¥½¥Ã¥É¤Î£±¤Ä¤Ç¡¢¥¯¥é¥¹¤¬¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬Ç˲õ¤µ¤ì¤¿ºÝ¤Ë¼«Æ°Åª¤Ë¼Â¹Ô¤µ¤ì¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£

»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
MonoBehaviour.OnDestroy
https://docs.unity3d.com/ja/current/ScriptReferenc...

¡¡¤³¤Î¥á¥½¥Ã¥É¤Î¼Â¹Ô¥¿¥¤¥ß¥ó¥°¤Ç¼«Æ°Åª¤Ë ReactivePropery ¤ò Dispose ¤¹¤ëµ¡Ç½¤¬ UniRX ¤Ë¤Ï¤¢¤ë¤¿¤á¡¢
¤½¤Îµ¡Ç½¤ò GameManager ¥¯¥é¥¹Â¦¤Ç¼Â¹Ô¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ë OnDestroy ¥á¥½¥Ã¥É¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£


CharaDetail.cs

<= ¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹


¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£


£³¡¥GameManager ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤¹¤ë


¡¡CharaDetail ¥¯¥é¥¹¤ËÄɲä·¤¿ ReactivePropery ¤Î´Æ»ë½èÍý¤òÄɲä·¤Þ¤¹¡£
GameManager ¥¯¥é¥¹Â¦¤Ç´Æ»ë¤ò¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢CharaDetail ¥¯¥é¥¹Â¦¤Ï GameManager ¥¯¥é¥¹¤òÃΤëɬÍפ¬¤Ê¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£

¡¡¤³¤³¤Ç¤â´Æ»ë½èÍý¤Ï°ìÅټ¹Ԥ¹¤ì¤Ð¡¢¤¢¤È¤Ï¤º¤Ã¤È´Æ»ë¾õÂ֤ˤʤê¤Þ¤¹¡£
¤½¤Î¸å¡¢CharaDetail ¥¯¥é¥¹¤Î¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬ÇË´þ¤µ¤ì¤ë¥¿¥¤¥ß¥ó¥°¤Ç
CharaDetail¥¯¥é¥¹¤ËÄɲä·¤¿ OnDestroy ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¡¢ReactivePropery ¤âƱ¥¿¥¤¥ß¥ó¥°¤ÇÇË´þ¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£

¡¡´Æ»ë¾õÂÖ¤Ïȯ¹Ô¸µ¤Ç¤¢¤ë¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¤Ê¤¯¤Ê¤Ã¤Æ¤â¼«Æ°Åª¤Ë¤Ï½ªÎ»¤·¤Þ¤»¤ó¡£
¤½¤Î¤¿¤á¡¢¼Â¹Ô¤Ç¤­¤Ê¤¤½èÍý¤ò¤º¤Ã¤È´Æ»ë¤¹¤ë¾õÂ֤ȤʤäƻĤäƤ·¤Þ¤¤¤Þ¤¹¤Î¤Ç¡¢É¬¤ºÅ¬Àڤʥ¿¥¤¥ß¥ó¥°¤Ç ReactivePropery ¤ò Dispose ¤·¤ÆÇË´þ¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£


GameManager.cs

¡¡<=¡¡¥¯¥ê¥Ã¥¯¤¹¤ë¤È³«¤­¤Þ¤¹


¡¡¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤¿¤é¥»¡¼¥Ö¤·¤Þ¤¹¡£


£´¡¥¡ãUniRX ¤Î´ðËÜÆ°ºî­¢¡¡¡¼AddTo ¥á¥½¥Ã¥É¡¼¡ä


¡¡¤¢¤È¤«¤é Dispose ¤ò¸Æ¤Ó½Ð¤¹¤è¤¦¤ËÅÐÏ¿¤·¤Æ¤ª¤¯¤³¤È¤¬¤Ç¤­¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
AddTo ¥á¥½¥Ã¥É¤ÎÂоÝÀè¤È¤·¤ÆÅÐÏ¿¤Ç¤­¤ë¤Î¤Ï°Ê²¼¤Î£²¤Ä¤Î¥¿¥¤¥ß¥ó¥°¤Ë¤Ê¤ê¤Þ¤¹¡£

¡¡£±¡¥GameObject ¤Î OnDestroy ¥á¥½¥Ã¥É¤Î¼Â¹Ô¥¿¥¤¥ß¥ó¥°
¡¡£²¡¥CompositeDisposable ¤Î Dispose ¤Î¼Â¹Ô¥¿¥¤¥ß¥ó¥°

¡¡º£²ó¤Ï CharaDetail ¥¯¥é¥¹¤Ë OnDestroy ¥á¥½¥Ã¥É¤òÄɲä·¡¢¤³¤Î¥á¥½¥Ã¥É¤Î¼Â¹Ô¥¿¥¤¥ß¥ó¥°¤Ç
ReactivePropery ¤Î Dispose ¤ò¹Ô¤¦¤è¤¦¤ËÀ߷פ·¤Æ¤¤¤Þ¤¹¡£

  // CharaDetail ¥¯¥é¥¹¤ÎReactivePropery ¤ò´Æ»ë¤¹¤ë
  chara.ButtonReactiveProperty.Where(x => x == true).Subscribe(_ => ResultJobs(tapPointDetail)).AddTo(chara.gameObject);

¡¡Å¬Àڤʥ¿¥¤¥ß¥ó¥°¤Ç Dispose ¤·¤Æ¤ª¤«¤Ê¤¤¤È¡¢¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¤Ê¤¯¤Ê¤Ã¤Æ¤â½èÍý¼«ÂΤÏÆ°¤­Â³¤±¤Æ¤·¤Þ¤¦¤¿¤á¡¢Ãí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£


£µ¡¥¥²¡¼¥à¤ò¼Â¹Ô¤·¤ÆÆ°ºî¤ò³Îǧ¤¹¤ë


¡¡º£²ó¤Î¼ÂÁõ¤â¥ê¥Õ¥¡¥¯¥¿¥ê¥ó¥°¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢¥²¡¼¥à¾å¤Î½èÍý¤Ïº£¤Þ¤Ç¤ÈƱ¤¸¤è¤¦¤ËÀµ¾ï¤ËÆ°ºî¤·¤Æ¤¤¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£


¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯

¥³¥á¥ó¥È¤ò¤«¤¯


¡Öhttp://¡×¤ò´Þ¤àÅê¹Æ¤Ï¶Ø»ß¤µ¤ì¤Æ¤¤¤Þ¤¹¡£

ÍøÍѵ¬Ìó¤ò¤´³Îǧ¤Î¤¦¤¨¤´µ­Æþ²¼¤µ¤¤

Menu


´ðÁÃ

µ»½Ñ/Ãμ±(¼ÂÁõÎã)

3D¥¢¥¯¥·¥ç¥ó¥²¡¼¥à

2D¤ª¤Ï¤¸¤­¥²¡¼¥à(ȯŸÊÔ)

2D¶¯À©²£¥¹¥¯¥í¡¼¥ë¥¢¥¯¥·¥ç¥ó(ȯŸÊÔ)

2D¥¿¥Ã¥×¥·¥å¡¼¥Æ¥£¥ó¥°(³ÈÄ¥ÊÔ)

¥ì¡¼¥¹¥²¡¼¥à(È´¿è)

2DÊüÃÖ¥²¡¼¥à(ȯŸÊÔ)

3D¥ì¡¼¥ë¥¬¥ó¥·¥å¡¼¥Æ¥£¥ó¥°(±þÍÑÊÔ)

3Dæ½Ð¥²¡¼¥à(È´¿è)

2D¥ê¥¢¥ë¥¿¥¤¥à¥¹¥È¥é¥Æ¥¸¡¼

3D¥¿¥Ã¥×¥¢¥¯¥·¥ç¥ó(NavMeshAgent »ÈÍÑ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥«¥¨¥ë¤Î°Ù¤Ë¡Á¡¢¥Ü¥³¥¹¥«¥¦¥©¡¼¥ºÉ÷)

VideoPlayer ¥¤¥Ù¥ó¥ÈϢư¤Î¼ÂÁõÎã

VideoPlayer ¥ê¥¹¥ÈÆ⤫¤é¥à¡¼¥Ó¡¼ºÆÀ¸¤Î¼ÂÁõÎã(ȯŸ)

AR ²èÁüÉÕ¤­¥ª¥Ö¥¸¥§¥¯¥ÈÀ¸À®¤Î¼ÂÁõÎã

AR ¥ê¥¹¥ÈÆ⤫¤éÀ¸À®¤Î¼ÂÁõÎã(ȯŸ)

2D¥È¥Ã¥×¥Ó¥å¡¼¥¢¥¯¥·¥ç¥ó(¥µ¥Ð¥¤¥Ð¡¼É÷)

private



¤³¤Î¥µ¥¤¥ÈÆâ¤ÎºîÉʤϥæ¥Ë¥Æ¥£¤Á¤ã¤ó¥é¥¤¥»¥ó¥¹¾ò¹à¤Î¸µ¤ËÄ󶡤µ¤ì¤Æ¤¤¤Þ¤¹¡£

´ÉÍý¿Í/Éû´ÉÍý¿Í¤Î¤ßÊÔ½¸¤Ç¤­¤Þ¤¹