ºÇ½ª¹¹¿·¡§
orika_ex_miyako 2022ǯ11·î21Æü(·î) 11:46:15ÍúÎò
¤¢¤ê¤¬¤È¤¦¤´¤¶¤¤¤Þ¤¹¡£
gamebox ÍÍ
¡Úunity¡ÛÊüÃÖ¥²¡¼¥à/¥½¥·¥ã¥²·Ï¤Î¥ª¥Õ¥é¥¤¥óÊó½·1¡Ú¥¹¥¯¥ê¥×¥È¡Û
https://www.unitygamebox.com/?p=716
¡¡
¡¡¥²¡¼¥àÆâ¤Ç¼èÆÀ¤·¤¿É¬ÍפʾðÊ󷲤ò¥»¡¼¥ÖÍѤΥ¯¥é¥¹¤Ë¤Þ¤È¤á¡¢°ì³ç¤Ç¥»¡¼¥Ö¡¦¥í¡¼¥É¤¹¤ë¤¿¤á¤Îµ¡Ç½¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¡¡½èÍý¤Î¼ÂÁõ¤Ë¤¢¤¿¤Ã¤Æ¤Ï¡¢¥»¡¼¥Ö¡¦¥í¡¼¥É¤Î¤ß¤Îµ¡Ç½¤òÈ÷¤¨¤¿¥¯¥é¥¹¤òºîÀ®¤·¤Þ¤¹¡£
¤³¤Á¤é¤ÏUnity ¤ä C# ¤ÎÍÑ°Õ¤·¤Æ¤¤¤ë£³¤Ä¤Îµ¡Ç½¤ò³èÍѤ¹¤ë¤³¤È¤Ç¼ÂÁõ¤ò¹Ô¤¦¤è¤¦¤ËÀ߷פ·¤Æ¤¤¤Þ¤¹¡£
¡¡¤½¤Î¸å¡¢¼¡¤Î¼ê½ç¤Ë¤ª¤¤¤Æ¡¢ºîÀ®¤·¤¿¥¯¥é¥¹¤ËÍÑ°Õ¤·¤¿¥á¥½¥Ã¥É¤òŬµ¹¤Ê¥¿¥¤¥ß¥ó¥°¤Ç¼Â¹Ô¤·¤Æ¡¢¥»¡¼¥Ö¤È¥í¡¼¥É¤ò¼Â¹Ô¤·¤Þ¤¹¡£
¡¡¤³¤Î¤è¤¦¤Ë¡¢¥×¥í¥°¥é¥à¤Ë¤ª¤¤¤Æ¤Ï¡¢¼ÂÁõ¤ÎÁ°Ãʳ¬¤È¤Ê¤ë°Û¤Ê¤ëµ¡Ç½¤Î¼ÂÁõ¤«¤éºî¤Ã¤Æ¤¤¤¯¥±¡¼¥¹¤¬Â¿¤¯¤¢¤ê¤Þ¤¹¡£
½èÍý¤ÎÁ´ÂÎÁü¤òÇÄ°®¤·¤¿¾å¤Ç²¼½àÈ÷¤ò¹Ô¤¤¡¢¤½¤Î¸å¡¢²¼½àÈ÷¤È¤·¤Æ´°À®¤·¤Æ¤¤¤ëµ¡Ç½(º£²ó¤Ç¤¢¤ì¤Ð¥»¡¼¥Ö¡¦¥í¡¼¥Éµ¡Ç½)¤ò»È¤¤¡¢
¼ÂºÝ¤Ë½èÍý¤Ë¼è¤êÆþ¤ì¤Æ¹½ÃÛ¤·¤Æ¤¤¤¤Þ¤¹¡£
¡¡¤¤¤¯¤Ä¤â¤Î°Û¤Ê¤ë½èÍý¤¬¤Ä¤Ê¤¬¤Ã¤Æ¡¢Â礤ʽèÍý¤ò¤Ä¤¯¤Ã¤Æ¤¤¤¯(¥í¥¸¥Ã¥¯¤È¤·¤ÆÁȤßΩ¤Æ¤Æ¤¤¤¯)¤È¤¤¤¦¥¤¥á¡¼¥¸¤ò»ý¤Ä¤³¤È¤¬ÂçÀڤˤʤê¤Þ¤¹¡£
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦static ¥¯¥é¥¹¤È static ¥á¥½¥Ã¥É ¡¡¡¦PlayerPrefs ¥¯¥é¥¹¤È³Æ¥á¥½¥Ã¥É¡¡¡¼Set¡Á ¥á¥½¥Ã¥É¡¢Save ¥á¥½¥Ã¥É¡¢HasKey ¥á¥½¥Ã¥É¡¢Get¡Á ¥á¥½¥Ã¥É¡¢DeleteKey ¥á¥½¥Ã¥É¡¢DeleteAll ¥á¥½¥Ã¥É¡¼ ¡¡¡¦JsonUtility ¥¯¥é¥¹ ¡¡¡¦·¿°ú¿ô¤È¥¸¥§¥Í¥ê¥Ã¥¯·¿
¡¡¥»¡¼¥Ö¡¦¥í¡¼¥É¤Îµ¡Ç½¤Ë¤Ä¤¤¤Æ¤Ï¥ª¥Õ¥é¥¤¥ó(¥µ¡¼¥Ð¡¼¤òÍøÍѤ·¤Ê¤¤)¤Ç¡¢¥¹¥Þ¥Û¤Î¾ì¹ç¤Ç¤¢¤ì¤ÐüËöÆâ¤Ë¥»¡¼¥Ö¥Ç¡¼¥¿¤òÊÝ»ý¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¤³¤Îµ¡Ç½¤Ï Unity ¤ÎÍÑ°Õ¤·¤Æ¤¤¤ë PlayerPrefs(¥×¥ì¥¤¥ä¡¼¥×¥ì¥Õ¥¹) ¥¯¥é¥¹¤òÍøÍѤ¹¤ë¤³¤È¤Ç¼ÂÁõ¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡¥²¡¼¥à¤Ë¤ª¤¤¤Æ¤ÏÍÍ¡¹¤ÊÉôʬ¤Ç¥»¡¼¥Ö¤È¥í¡¼¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤¬ÁÛÄꤵ¤ì¤Þ¤¹¤Î¤Ç¡¢¤½¤¦¤¤¤Ã¤¿¾ì¹ç¤ËÈ÷¤¨¤Æ
PlayerPrefs ¥¯¥é¥¹¤Îµ¡Ç½¤ò¤µ¤é¤Ë¼«Ê¬¤Î¥²¡¼¥àÍѤ˥«¥¹¥¿¥Þ¥¤¥º¤·¤Æ¡¢¥²¡¼¥àÆâÍƤ˨¤·¤¿£±¤Ä¤Î¿·¤·¤¤¥¯¥é¥¹¤òºîÀ®¤·¤Æ¤ª¤¯À߷פˤ·¤Þ¤¹¡£
¡¡¤³¤Î¤è¤¦¤Ë¤·¤Æ¤ª¤¯¤³¤È¤Ë¤è¤ê¡¢¥²¡¼¥àÆâ¤Î¥»¡¼¥Ö¡¦¥í¡¼¥É¤Ë´Ø¤·¤Æ¤Ï¡¢¤³¤Î¥¯¥é¥¹¤òÍøÍѤ¹¤ì¤Ð¤è¤¤¾õÂÖ¤òºî¤ê½Ð¤¹¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡PlayerPrefs ¥¯¥é¥¹¤Ç¤Ï¡¢£³¤Ä¤Î·¿¤Î¾ðÊó¤ò¥»¡¼¥Ö¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£int ·¿¡¢float ·¿¡¢string ·¿¤Ë¤Ê¤ê¤Þ¤¹¡£
¤¿¤À¤·¡¢¼«ºî¤·¤¿¥¯¥é¥¹¤½¤Î¤â¤Î¤Ç¤¢¤Ã¤¿¤ê¡¢¤¢¤ë¤¤¤Ï»þ´Ö¤Î¥Ç¡¼¥¿¤Ç¤¢¤ë DateTime(¥Ç¥¤¥È¥¿¥¤¥à) ¹½Â¤ÂΤʤɤϾ嵤Τ¤¤º¤ì¤Î·¿¤Ë¤âÅö¤Æ¤Ï¤Þ¤ê¤Þ¤»¤ó¡£
¤½¤Î¤¿¤á¡¢º£¤Î¤Þ¤Þ¤Ç¤Ï PlayerPrefs ¤ÎÍÑ°Õ¤·¤Æ¤¤¤ë·¿¤È°Û¤Ê¤Ã¤Æ¤·¤Þ¤Ã¤Æ¡¢¥»¡¼¥Ö¡¦¥í¡¼¥É¤¬¹Ô¤¨¤Þ¤»¤ó¡£
¡¡¤³¤Î¤è¤¦¤Ê¤È¤¤Ë¤Ï¤¤¤¯¤Ä¤«¤ÎÊýË¡¤¬¹Í¤¨¤é¤ì¤Þ¤¹¤¬¡¢º£²ó¤Ï¡¢¤Þ¤ºÊݸÍѤΥ¯¥é¥¹¤òºîÀ®¤·¡¢¤½¤ÎÃæ¤Ë¥»¡¼¥Ö¡¦¥í¡¼¥É¤·¤ÆÍøÍѤ·¤¿¤¤¾ðÊó¤ò¤Þ¤È¤á¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¼ç¤Ë¤Ï¥æ¡¼¥¶¡¼¤Î¾ðÊó¤Ë¤Ê¤ê¤Þ¤¹¤¬¡¢¤½¤Î¾ì¹ç¡¢¥¹¥³¥¢¡¢¤ª¶â¤Ê¤É¤Î int ·¿¤Î¾ðÊó¡¢bool ·¿¤Î¾ðÊó¡¢
¤½¤·¤Æ¼«ºî¥¯¥é¥¹Æâ¤Î¾ðÊó¤Ê¤É¤Ç¤¢¤Ã¤Æ¤â¡¢ÊݸÍѤΥ¯¥é¥¹¤ÎÃæ¤Ë°ì³ç¤Ç¤Þ¤È¤á¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¤½¤·¤Æ¡¢¤½¤ÎÊݸÍѤΥ¯¥é¥¹¤Î¥Ç¡¼¥¿¤Î·¿¤Îºî¤ê¤ò PlayerPrefs ¤Ç¤Î¥»¡¼¥Ö¡¦¥í¡¼¥É¤¬¹Ô¤¨¤ë string ·¿¤ËÊѹ¹¤·¤Æ¤«¤é¡¢¥»¡¼¥Ö¡¦¥í¡¼¥É¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡ã¥¤¥á¡¼¥¸¡ä
UserData.cs(¥»¡¼¥Ö¤·¤¿¤¤¥¯¥é¥¹¡¡¤½¤Î£±)
public class UserData : MonoBehaviour { public int score;¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó public int money;¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó public bool isFirstMission;¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó ¡¡¡¡¡¡°Ê²¼¤Ë¤Ï¡¢¥»¡¼¥Ö¤·¤Ê¤¯¤Æ¤â¤è¤¤¾ðÊó(ÊÑ¿ô¤ä¥á¥½¥Ã¥É)¤¬¤¢¤ë¤È¤·¤Þ¤¹¡£ }
ItemInvenrty.cs(¥»¡¼¥Ö¤·¤¿¤¤¥¯¥é¥¹¡¡¤½¤Î£²)
public class ItemInvenrty : MonoBehaviour { public class ItemInvenrtyData { public int itemId; public string itemName; } public List<ItemInventryData> itemInventryDataList = new();¡¡¡¡¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó ¡¡¡¡¡¡°Ê²¼¤Ë¤Ï¡¢¥»¡¼¥Ö¤·¤Ê¤¯¤Æ¤â¤è¤¤¾ðÊó(ÊÑ¿ô¤ä¥á¥½¥Ã¥É)¤¬¤¢¤ë¤È¤·¤Þ¤¹¡£ }
¡¡¾åµ¤Î¤è¤¦¤Ê¹½Â¤¤Ë¤Ê¤Ã¤Æ¤¤¤ë£²¤Ä¤Î¥¯¥é¥¹¤ÎÆâÍƤò¥»¡¼¥Ö¡¦¥í¡¼¥É¤·¤¿¤¤¡¢¤È¹Í¤¨¤¿¾ì¹ç¤Ë¤Ï¡¢³ÆÊÑ¿ô¤´¤È¤Ë£±¤Ä¤º¤Ä¥»¡¼¥Ö¡¦¥í¡¼¥É¤µ¤»¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢
Ê̤ÎÊݸÍѤΥ¯¥é¥¹¤òÍÑ°Õ¤·¡¢¤½¤Á¤é¤Ë¥»¡¼¥Ö¡¦¥í¡¼¥É¤·¤¿¤¤¾ðÊó¤ò³Æ¥¯¥é¥¹¤«¤é¥Ô¥Ã¥¯¥¢¥Ã¥×¤·¤Æ¤Þ¤È¤á¤Æ¤ª¤¡¢¤½¤ì¤ò¥»¡¼¥Ö¡¦¥í¡¼¥É¤µ¤»¤ë¤È¤¤¤¦·Á¤Ë¤·¤Þ¤¹¡£
¡¡¡¡¡¡¢
SaveData.cs(¾åµ¤Î£²¤Ä¤Î¥¯¥é¥¹Æ⤫¤é¡¢¥»¡¼¥Ö¤·¤¿¤¤¾ðÊó¤ò¤Þ¤È¤á¤¿¥¯¥é¥¹)
public class SaveData { public int score;¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó public int money;¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó public bool isFirstMission;¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó public List<ItemInventryData> itemInventryDataList = new();¡¡¡¡¡¡//¡¡Êݸ¤·¤¿¤¤¾ðÊó ¡¡¡¡¡¡// ¾¤Ë¤â¤¢¤ì¤ÐÄɲ䷤Ƥ¤¤¯ }
¡¡¤³¤Î¤è¤¦¤Ë¤¹¤ë¤³¤È¤Ç¡¢¥»¡¼¥Ö¡¦¥í¡¼¥É¤ËɬÍפʾðÊó¤ò¤Þ¤È¤á¤Æ´ÉÍý½ÐÍè¤Þ¤¹¡£
¡¡¾åµ¤Î¾ì¹ç¡¢SaveData ¥¯¥é¥¹¤Ï¼«ºî¥¯¥é¥¹¤Ë¤Ê¤ë¤¿¤á¡¢·¿¤È¤·¤Æ¤Ï SaveData ·¿¤È¤Ê¤ê¡¢¤½¤Î¤Þ¤Þ¤Ç¤Ï PlayerPrefs ¥¯¥é¥¹¤Ç¤Ï¥»¡¼¥Ö¡¦¥í¡¼¥É¤¬¹Ô¤¨¤Þ¤»¤ó¡£
¤³¤Á¤é¤ò string ·¿¤Î¾ðÊó¤Ø¤ÈÊÑ´¹¤·¡¢¤½¤Î¸å¡¢PlayerPrefs ¤Îµ¡Ç½¤òÍøÍѤ·¤Æ string ·¿¤Ç¥»¡¼¥Ö¡¦¥í¡¼¥É¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡Unity ¤ÎÍÑ°Õ¤·¤Æ¤¤¤ëµ¡Ç½¤Î£±¤Ä¤Ë JsonUtility(¥¸¥§¥¤¥½¥ó¡¦¥æ¡¼¥Æ¥£¥ê¥Æ¥£) ¥¯¥é¥¹¤¬¤¢¤ê¤Þ¤¹¡£
¤³¤Î¥æ¡¼¥Æ¥£¥ê¥Æ¥£¥¯¥é¥¹¤òÍøÍѤ¹¤ë¤È¡¢»ØÄꤷ¤¿·¿¤Î¾ðÊó¤ò Json ·Á¼°¤È¸Æ¤Ð¤ì¤ë¼ïÎà¤Î string ·¿¤Îʸ»ú¤ËÊÑ´¹¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¤Þ¤¿ JsonUtility ¥¯¥é¥¹¤Ç¤Ï¡¢string ·¿¤Î¾ðÊó¤ò¸µ¤Î¥¯¥é¥¹¤Î¾ðÊó¤ËÌ᤹½èÍý¤â¼Â¹Ô¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¤³¤Î¤è¤¦¤Ë¡¢¾ðÊó¤ò½ñ¤´¹¤¨¤Æ¤¢¤²¤ë¤³¤È¤Ç¡¢PlayerPrefs ¥¯¥é¥¹¤Î¥»¡¼¥Ö¡¦¥í¡¼¥É¤¬¤Ç¤¤ë string ·¿¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢
¥»¡¼¥Ö¤ò¹Ô¤¦ºÝ¤Ë string ·¿¤Ë¤·¤ÆÊݸ¤·¡¢¥í¡¼¥É¤ò¹Ô¤¦ºÝ¤Ë¤Ï¤³¤Î string ·¿¤Ç¥í¡¼¥É¤·¤Æ¡¢¤½¤Î¾ðÊó¤ò¸µ¤Î·¿¤Î¾ðÊó¤ËÌ᤹¤³¤È¤Ç¡¢
PlayerPrefs ¥¯¥é¥¹¤òÍøÍѤ·¤Æ¥»¡¼¥Ö¤È¥í¡¼¥É¤¬¹Ô¤¨¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡½èÍý¤Îή¤ì¤ò¤Þ¤È¤á¤Þ¤¹¡£
¡ã¥»¡¼¥Ö¤¹¤ë¤È¤¡ä
¡¡¡¦¥»¡¼¥Ö¤·¤¿¤¤¾ðÊó(¥¯¥é¥¹¡¦·¿)¤¬ PlayerPrefs ¥¯¥é¥¹¤ËÂбþ¤·¤Æ¤¤¤ë·¿¤Ç¤Ï¤Ê¤¤¤¿¤á¡¢¤½¤Î¤Þ¤Þ¤Ç¤Ï¼«ºî¥¯¥é¥¹¤ä¡¢»þ´Ö¤Î¾ðÊó¤Ê¤É¤ò¥»¡¼¥Ö¤Ç¤¤Ê¤¤¡£ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ ¡¡¡¦¥»¡¼¥Ö¤·¤¿¤¤¾ðÊ󤬥¯¥é¥¹¤Î¾ì¹ç¡¢JsonUtility ¥¯¥é¥¹¤Î ToJson ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¡¢¥»¡¼¥Ö¤·¤¿¤¤¾ðÊó(¥¯¥é¥¹¡¦·¿)¤ò string ·¿(Json ·Á¼°)¤ËÊÑ´¹¤¹¤ë¡£ ¡¡¡¡ ¡¡¡¡¥»¡¼¥Ö¤·¤¿¤¤¾ðÊ󤬻þ´Ö(DateTime ¹½Â¤ÂÎ)¤Î¾ì¹ç¡¢ToString ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¡¢string ·¿¤ËÊÑ´¹¤¹¤ë¡£ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ ¡¡¡¦¤³¤Î string ·¿¤Î¾ðÊó¤ò PlayerPrefs ¥¯¥é¥¹¤Î SetString ¥á¥½¥Ã¥É¤È Save ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¥»¡¼¥Ö¤¹¤ë¡£
¡ã¥í¡¼¥É¤¹¤ë¤È¤¡ä
¡¡¡¦string ·¿¤Ç¥»¡¼¥Ö¤·¤Æ¤¢¤ë¾ðÊó¤ò PlayerPrefs ¥¯¥é¥¹¤Î GetString ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¥í¡¼¥É¤ò¤¹¤ë¡£ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ ¡¡¡¦¥í¡¼¥É¤·¤¿¾ðÊó(¥¯¥é¥¹¡¦·¿)¤¬ string ·¿¤Î¤¿¤á¡¢¤½¤Î¤Þ¤Þ¤Ç¤Ï¥»¡¼¥Ö¤¹¤ëÁ°¤Î¥¯¥é¥¹¤Î¾ðÊó¤È¤·¤Æ³èÍѤǤ¤Ê¤¤¡£ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ ¡¡¡¦¥í¡¼¥É¤·¤¿¾ðÊ󤬥¯¥é¥¹¤Î¾ì¹ç¡¢JsonUtility ¥¯¥é¥¹¤Î FromJson ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¡¢string ·¿(Json ·Á¼°)¤ò¥í¡¼¥É¤·¤¿¤¤¾ðÊó(¥¯¥é¥¹¡¦·¿)¤ËÊÑ´¹¤·¤ÆÉü¸µ¤¹¤ë¡£ ¡¡¡¡¤³¤ì¤Ï¡¢¥»¡¼¥Ö¤·¤¿ºÝ¤Î¾ðÊó¤Î·¿¤È¥í¡¼¥É¤¹¤ëºÝ¤Î¾ðÊó¤Î·¿¤¬Æ±¤¸¤â¤ÎƱ»Î¤Ç½èÍý¤¬¹Ô¤¨¤ë¡£ ¡¡¡¡¥í¡¼¥É¤·¤¿¾ðÊ󤬻þ´Ö(DateTime ¹½Â¤ÂÎ)¤Î¾ì¹ç¡¢DateTime ¹½Â¤ÂΤλý¤Ä¥á¥½¥Ã¥É¤òÍøÍѤ·¤ÆÊÑ´¹¤·¤ÆÉü¸µ¤¹¤ë¡£ ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¢ ¡¡¡¦¥»¡¼¥Ö¤¹¤ëºÝ¤Î¾ðÊó(¥¯¥é¥¹)¤ËÉü¸µ¤µ¤ì¤ë¤Î¤Ç¡¢¤³¤Î¾ðÊó¤ò¤Þ¤¿¥²¡¼¥à¤ÇÍøÍѤ¹¤ë
¡¡´Êñ¤Ê½èÍý¤Ç¤Ï¤¢¤ê¤Þ¤»¤ó¤Î¤Ç¡¢¤·¤Ã¤«¤ê¤È½èÍý¤Îή¤ì¤òÇÄ°®¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡JSON(JavaScript Object Notation)¤È¤Ï¡ÖJavaScript¤Î¥ª¥Ö¥¸¥§¥¯¥ÈµË¡¤òÍѤ¤¤¿¥Ç¡¼¥¿¸ò´¹¥Õ¥©¡¼¥Þ¥Ã¥È¡×¤Ç¤¹¡£
ÍÍ¡¹¤Ê¸À¸ì¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¤¿¤á¡¢¤³¤Î¾ðÊó¤ò³èÍѤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢Â¾¤Î¸À¸ì´Ö¤Î¥Ç¡¼¥¿¤Î¼õ¤±ÅϤ·¤ò´Êñ¤Ë¤¹¤ë¤¿¤á¤Îµ¡Ç½¤Ç¤¹¤¬¡¢
º£²ó¤Î¾ì¹ç¤Ï¡¢string ·¿¤Î¾ðÊó¤Ë¤Ê¤ê¡¢¤½¤Î¸å¡¢¥¯¥é¥¹¤È¤·¤ÆÉü¸µ¤Ç¤¤ëÉôʬ¤Ë³èÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¡Unity ¤Î PlayerPrefs ¥¯¥é¥¹¤È JsonUtility ¥¯¥é¥¹¤òÍøÍѤ·¤Æ¡¢¥²¡¼¥à¤ÎÆâÍƤ˨¤·¤¿¥¯¥é¥¹¤òºîÀ®¤·¤Þ¤¹¡£
¤³¤Î¤è¤¦¤Ë´û¸¤Î¥¯¥é¥¹¤ä¥á¥½¥Ã¥É¤ÎÍøÊØÀ¤ò¹â¤á¤ë¤è¤¦¤ËºîÀ®¤¹¤ë¥¯¥é¥¹¤òÁí¾Î¤·¤Æ¥æ¡¼¥Æ¥£¥ê¥Æ¥£¥¯¥é¥¹(¥Ø¥ë¥Ñ¡¼¥¯¥é¥¹)¤È¤¤¤¤¤Þ¤¹¡£
¡¡¥æ¡¼¥Æ¥£¥ê¥Æ¥£¥¯¥é¥¹(¥Ø¥ë¥Ñ¡¼¥¯¥é¥¹)¤Ï static ¥¯¥é¥¹¡¦ static ¥á¥½¥Ã¥É¤Î¤ß¤ò»ý¤ÄÆâÍƤˤʤê¤Þ¤¹¡£
¤½¤Î¤è¤¦¤Ê¹½Â¤¤Ë¤·¤Æ¤ª¤¯¤³¤È¤Ç¡¢³Æ¥¯¥é¥¹¤Ë¤ª¤¤¤Æ¶¦Ä̤·¤ÆÍøÍѤ·¤¿¤¤½èÍý¤ò¡¢¤É¤Î¥¯¥é¥¹¤«¤é¤Ç¤â´Êñ¤Ë¥¢¥¯¥»¥¹¤Ç¤¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤Þ¤¹¡£
¤Þ¤¿ÈÆÍÑŪ¤ËÍøÍѤ¹¤ë´ØÏ¢À¤Î¤¢¤ë½èÍý¤ò¤Þ¤È¤á¤Æ¤ª¤¯¤³¤È¤âÌÜŪ¤Ë¤·¤Æ¤¤¤Þ¤¹¡£
¡¡¥â¥Î¥Ó¥Ø¥¤¥Ó¥¢¡¼¤Î·Ñ¾µ¤¬¤Ê¤¤¤¿¤á¡¢¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥¢¥¿¥Ã¥Á¤¬ÉÔÍפǤ¹(Àµ³Î¤Ë¸À¤¦¤È½ÐÍè¤Þ¤»¤ó)¡£
¾¤Î¥¤¥ó¥¹¥¿¥ó¥¹¥á¥ó¥Ð¡¼¤È°Û¤Ê¤ê¡¢¥¯¥é¥¹¤´¤È¤ËÍ£°ì¤Î¼ÂÂΤò»ý¤Á¡¢¤¹¤Ù¤Æ¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤Ç¶¦Í²½¤µ¤ì¤ë¾ðÊó¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡Îã¤òµó¤²¤ë¤È¡¢³Æ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ï¤½¤ì¤¾¤ì£±¤Ä¤º¤Ä TapPointDetail ¤È¤¤¤¦Ì¾Á°¤Î¥¯¥é¥¹¤¬¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¤È¤·¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¤½¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¥²¡¼¥àÆâ¤Ë£µ¤Ä¤¢¤ë¤È¤¹¤ë¤Ê¤é¡¢TapPointDetail ¥¯¥é¥¹¤â£µ¤Ä¤¢¤ê¡¢
Ʊ̾¥¯¥é¥¹¤Ç¤Ï¤¢¤ë¤â¤Î¤Î¡¢¤½¤ì¤¾¤ì¤¬°Û¤Ê¤ë¥¤¥ó¥¹¥¿¥ó¥¹¤ò»ý¤Ã¤Æ¤¤¤ë¾õÂ֤Ǥ¹¡£
Ʊ¤¸À߷׿Þ(¥¯¥é¥¹)¤«¤é¡¢³°¸«¤¬Æ±¤¸°Û¤Ê¤ë¤â¤Î(¥¯¥é¥¹¤Î¥¤¥ó¥¹¥¿¥ó¥¹)¤ò£µ¤Äºî¤Ã¤Æ¤¤¤ë¥¤¥á¡¼¥¸¤Ç¤¹¡£
¤è¤Ã¤Æ¡¢¥¹¥¯¥ê¥×¥ÈÆâ¤Ë¤ª¤¤¤Æ TapPointDetail ¥¯¥é¥¹¤Î¾ðÊó¤òÍøÍѤ·¤¿¤¤¾ì¹ç¤Ë¤Ï¡¢ÂоݤȤʤë TapPointDetail ¥¯¥é¥¹¤Î¾ðÊó¤ò¼èÆÀ¤·¤ÆÍøÍѤ¹¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¤³¤ì¤ËÂФ·¤Æ¡¢static ½¤¾þ»Ò¤Î¥¯¥é¥¹¤Ï¡¢Ê£¿ô¸ºß¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤»¤ó¡£
PlayerPrefsHelper ¥¯¥é¥¹¤Ï¥²¡¼¥àÆâÄ̤¸¤Æ£±¤Ä¤·¤«Â¸ºß¤Ç¤¤Ê¤¤¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¤è¤Ã¤Æ¡¢ÂоݤȤʤ륯¥é¥¹¤Ï¾ï¤Ë£±¤Ä¤À¤±¤Ç¤¹¤Î¤Ç¡¢¥¯¥é¥¹¤Î¾ðÊó¤ò¼èÆÀ¤¹¤ëɬÍפ¬¤¢¤ê¤Þ¤»¤ó¡£
¡¡¥¯¥é¥¹¤ò¿Í¤ËÎ㤨¤¿¤È¤·¤Æ¡¢¡ÖTapPointDetail(º´Æ£) ¤µ¤ó¡×¤È¤À¤±À¼¤ò¤«¤±¤ë¤È£µ¿Í¤Î TapPointDetail (º´Æ£)¤µ¤ó¤¬¿¶¤ê¸þ¤¤¤Æ¤·¤Þ¤¦¤Î¤Ç¡¢
¡Ö¤³¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë(½Ð¿ÈÃϤȤ«¡¢²¼¤Î̾Á°¤È¤«¤Î¥¤¥á¡¼¥¸)¡×TapPointDetail (Ë̳¤Æ»¡¢¡Á»Ôºß½»¤Îº´Æ£ ¡Á)¤µ¤ó¤È¡¢¸ÄÊÌ»ØÄê¤òÀ¼¤ò¤«¤±¤ë¤Î¤ËÂФ·¡¢
¡ÖPlayerPrefsHelper ¤µ¤ó¡×¤ÈÀ¼¤ò¤«¤±¤ë¤È¡¢¾ï¤Ë°ì¿Í¤·¤«¤¤¤Ê¤¤¤Î¤Ç¡¢¤½¤Î¿Í¤¬É¬¤º¿¶¤ê¸þ¤¤¤Æ¤¯¤ì¤ë¡¢¤È¤¤¤¦¤è¤¦¤Ê¥¤¥á¡¼¥¸¤Ç¤¹¡£ÁíÍýÂç¿Ã¤ò¸Æ¤Ö´¶¤¸¤Ç¤·¤ç¤¦¤«¡£
¡¡static ¥¯¥é¥¹¤Ï¥¤¥ó¥¹¥¿¥ó¥¹¤ò»È¤Ã¤Æ»²¾È¤Ç¤¤Þ¤»¤ó¤Î¤Ç¡¢(¥¯¥é¥¹)·¿Ì¾¤ò»È¤Ã¤Æ»²¾È¤·¤Æ½èÍý¤ò¹Ô¤¤¤Þ¤¹¡£
¤³¤ì¤Ï¤É¤Î¥¯¥é¥¹¤«¤é¤Ç¤â¥á¥½¥Ã¥É¤Î¸Æ¤Ó½Ð¤·Ì¿Î᤬¼Â¹Ô¤Ç¤¤Þ¤¹¡£Î㤨¤Ð¡¢¡Ú PlayerPrefsHelper.¥á¥½¥Ã¥É̾ ¡Û¤Èµ½Ò¤¹¤ì¤Ð¥á¥½¥Ã¥É¤ò¼Â¹Ô¤Ç¤¤Þ¤¹¡£
¤³¤ì¤¬Â¾¤Î¥¯¥é¥¹¤È¤ÎÂ礤ʰ㤤¤Ë¤Ê¤ê¤Þ¤¹¡£
¡ãÄ̾ï¤Î¥¯¥é¥¹¤Î»²¾È¡ä
¡¡// ¥¯¥é¥¹(·¿)¤ÈÊÑ¿ô¤ÎÀë¸À TapPointDetail tapPointDetail; ¡¡// À©¸æ¤·¤¿¤¤¥¯¥é¥¹(·¿)¤Î¥¤¥ó¥¹¥¿¥ó¥¹¤ò¼èÆÀ¤·¤ÆÂåÆþ¤·¡¢ÊÑ¿ô¤ò²ð¤·¤Æ¥¤¥ó¥¹¥¿¥ó¥¹¤ò»²¾È¤Ç¤¤ë¾õÂ֤ˤ¹¤ë tapPointDetail = GatComponent<TapPointDetail>(); ¡¡// »²¾È¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤Ã¤¿¤Î¤Ç¡¢ÊÑ¿ô¤òÍøÍѤ·¤Æ½èÍý¤ò¼Â¹Ô¤¹¤ë tapPointDetail.¼Â¹Ô¤·¤¿¤¤ public ½¤¾þ»Ò¤Î¥á¥½¥Ã¥É̾¤äÊÑ¿ô̾;
¡ãstatic ¥¯¥é¥¹¤Î»²¾È¡ä
// ¥¤¥ó¥¹¥¿¥ó¥¹»²¾ÈÉÔÍפΤ¿¤á¡¢¥¯¥é¥¹(·¿)¤ò¤½¤Î¤Þ¤ÞÀë¸À¤·¤Æ»²¾È¤·¤Æ½èÍý¤ò¼Â¹Ô¤¹¤ë PlayerPrefsHelper.¼Â¹Ô¤·¤¿¤¤ public static ½¤¾þ»Ò¤Î¥á¥½¥Ã¥É̾;
¡¡»²¾È¤·¤Æ½èÍý¤ò¼Â¹Ô¤·¤Æ¤¤¤¯ºÝ¤ÎÊýË¡¤¬°ã¤¦¤³¤È¤¬¤ï¤«¤ë¤È»×¤¤¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
MicroSoft
static ½¤¾þ»Ò
https://docs.microsoft.com/ja-jp/dotnet/csharp/lan...
̤³ÎǧÈô¹Ô C ÍÍ
ÀÅŪ¥á¥ó¥Ð¡¼
https://ufcpp.net/study/csharp/oo_static.html
¡¡º£²ó¤Î¥Ø¥ë¥Ñ¡¼¥¯¥é¥¹¤â¤³¤ì¤ÈƱÍͤˡ¢static ¥¯¥é¥¹¤È¤·¤ÆºîÀ®¤·¡¢³Æ¥á¥½¥Ã¥É¤â static ¥á¥½¥Ã¥É¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢¾åµ¤Î»ÈÍÑÎã¤ò¤ß¤Æ¤¤¤¿¤À¤¤¤Æ¤â¤ï¤«¤ëÄ̤ꡢstatic ½¤¾þ»Ò¤Î¥¯¥é¥¹¤È¥á¥½¥Ã¥É¤Ë¤·¤ÆºîÀ®¤·¤Æ¤ª¤¯¤³¤È¤Ë¤è¤Ã¤Æ
¤¤¤º¤ì¤Î¥¯¥é¥¹¤«¤é¤Ç¤â¼«Í³¤Ë(ÊÑ¿ô¤Ø¤ÎÂåÆþÉÔÍפÇ)¡¢¸Æ¤Ó½Ð¤·Ì¿Îá¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡¤³¤Î¤è¤¦¤ÊÀ߷פˤʤäƤ¤¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢¥Ø¥ë¥Ñ¡¼¥¯¥é¥¹¤ÏÍøÊØÀ¤ò³ÎÊݤ·¤Æ¤¤¤Þ¤¹¡£
¡¡¥á¥¤¥ó¤È¤Ê¤Ã¤Æ¤¤¤ë¤Î¤Ï¡¢¥¯¥é¥¹¤ò string ·¿¤È¤·¤Æ¥»¡¼¥Ö¤ò¹Ô¤¤¡¢¥í¡¼¥É¤·¤Æ¸µ¤Î¥¯¥é¥¹¤ËÉü¸µ¤¹¤ëµ¡Ç½¤ò¥á¥½¥Ã¥É²½¤·¤ÆÍÑ°Õ¤·¤Æ¤¤¤Þ¤¹¡£
¾¤Ë¤âÊØÍø¤Êµ¡Ç½¤·¤Æ¡¢¥»¡¼¥Ö¥Ç¡¼¥¿¤¬Â¸ºß¤¹¤ë¤Î¤«¤ò³Îǧ¤¹¤ë¥á¥½¥Ã¥É¤ä¡¢À°¿ô¤Î¾ðÊó¤ò¥»¡¼¥Ö¡¦¥í¡¼¥É¤¹¤ëµ¡Ç½¡¢
¥Ç¥Ð¥Ã¥°¤ò´Êñ¤Ë¤¹¤ë¤¿¤á¤Ë¥»¡¼¥Ö¥Ç¡¼¥¿¤òºï½ü¤¹¤ëµ¡Ç½¤â¥á¥½¥Ã¥É²½¤·¤Æ¤¤¤Þ¤¹¡£
¡¡º£¸å¤â PlayerPrefs ¥¯¥é¥¹¤ò³èÍѤ·¤¿¤¤¾ì¹ç¤Ë¤Ï¿·¤·¤¯¥á¥½¥Ã¥É¤òºîÀ®¤·¤Æ¡¢µ¡Ç½¤´¤È¤ËÍÑ°Õ¤ò¤·¤Æ¤ª¤¯¤È¤è¤¤¤Ç¤·¤ç¤¦¡£
£³¡¥¡ãPlayerPrefs ¥¯¥é¥¹¤È³Æ¥á¥½¥Ã¥É¡¡¡¼Set¡Á ¥á¥½¥Ã¥É¡¢Save ¥á¥½¥Ã¥É¡¢HasKey ¥á¥½¥Ã¥É¡¢Get¡Á ¥á¥½¥Ã¥É¡¢DeleteKey ¥á¥½¥Ã¥É¡¢DeleteAll ¥á¥½¥Ã¥É¡¼¡ä ![](https://static.seesaawiki.jp/img/usr_second/common/icon_pen.gif)
¡¡Unity ¤Ç¤Ï¥Ç¡¼¥¿¤Î¥»¡¼¥Ö¡¦¥í¡¼¥É¤ò¹Ô¤¦¤¿¤á¤Î PlayerPrefs ¥¯¥é¥¹¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
PlayerPrefs ¥¯¥é¥¹¤Ë¤Ï¥»¡¼¥Ö¡¦¥í¡¼¥ÉÍѤΥ᥽¥Ã¥É¤ä¡¢¥Ç¡¼¥¿¤Î³Îǧ¥á¥½¥Ã¥É¡¢ºï½üÍѤΥ᥽¥Ã¥É¤Ê¤É¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢
¤³¤Á¤é¤ò¼ÂÁõ¤¹¤ë¤³¤È¤Ç»ØÄꤷ¤¿¥Ç¡¼¥¿¤ò¥»¡¼¥Ö¤·¤¿¤ê¡¢¥í¡¼¥É¤·¤¿¤ê¤¹¤ë¤³¤È¤¬²Äǽ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡¥Ç¡¼¥¿¤ÎÊݸÀè¤Ï¡¢Unity Editor ¤ä PC ¥²¡¼¥à¤Î¾ì¹ç¤Ë¤Ï PC ËÜÂΤΥϡ¼¥É¥Ç¥£¥¹¥¯¡¢Web ¤Î¾ì¹ç¤Ï¥Ö¥é¥¦¥¶Æâ¡¢¥¹¥Þ¥ÛüËö¤Î¾ì¹ç¤Ë¤Ï¥¢¥×¥êÆâ¤Î¥Ç¡¼¥¿¤Î¾ì½êÆâ¤Ç¤¹¡£
¡ãPlayerPrefs ¥¯¥é¥¹¡ä
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡£²¤Ä¤Î¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¥»¡¼¥Ö¤ò¹Ô¤¤¤Þ¤¹¤Î¤Ç¡¢½çÈÖ¤ËÀâÌÀ¤·¤Þ¤¹¡£
¡¡Key ¤È¤¤¤¦Ê¸»úÎó¤òÊݸ¤¹¤ëºÝ¤Î¼±Ê̻ҤȤ·¤Æ»ØÄꤷ¡¢¤½¤Î̾Á°¤òÍѤ¤¤Æ»ØÄꤵ¤ì¤¿·¿¤Î¾ðÊó¤ò¥»¡¼¥Ö¤¹¤ë¤¿¤á¤Î½àÈ÷¤ò¹Ô¤¤¤Þ¤¹¡£
Key ¤È¤Ï¤¤¤ï¤Ð¥»¡¼¥ÖÍѤΥé¥Ù¥ë¤Ç¤¢¤ê¡¢Ì¾Á°¤òÉÕ¤±¤ÆÊݸ¤Î¤³¤È¤Ç¤¹¡£¤³¤Î Key ¤Î¾ðÊó¤ò¥í¡¼¥É¤¹¤ëºÝ¤Ë¤âÍøÍѤ·¤Þ¤¹¡£
¡¡PlayerPrefs ¥¯¥é¥¹¤Ë¤Ï¥»¡¼¥Ö¤ÎÊýË¡¤¬£³¼ïÎàÍÑ°Õ¤µ¤ì¤Æ¤ª¤ê¡¢Set ¡Á ¤Ç»Ï¤Þ¤ë̿̾µ¬Â§¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£º£²óÍøÍѤ·¤Æ¤¤¤ë SetString ¥á¥½¥Ã¥É¤â¤½¤Î£±¤Ä¤Ç¤¹¡£
SetString ¤È¤¤¤¦Ì¾Á°¤ÎÄ̤ꡢʸ»úÎó¤ò¥»¡¼¥Ö¤·¤Æ¤ª¤¯¤³¤È¤¬½ÐÍè¤Þ¤¹¡£»Ä¤ë£²¤Ä¤Ï SetInt ¥á¥½¥Ã¥É¡¢SetFloat ¥á¥½¥Ã¥É¤Ç¤¢¤ê¡¢¤³¤ì¤é¤â¥á¥½¥Ã¥É̾¤ÈƱ̾¤Î·¿¤Î¾ðÊó¤ò¥»¡¼¥Ö¤·¤Þ¤¹¡£
¡¡º£²ó¥»¡¼¥Ö¤·¤¿¤¤°ìÈ֤ξðÊó¤Ï¤ª»È¤¤¤Î¥Ç¡¼¥¿¤ò´ÉÍý¤¹¤ë¥¯¥é¥¹¤È»þ´Ö¤Î¾ðÊó¤Ë¤Ê¤ê¤Þ¤¹¤¬¡¢¥¯¥é¥¹¤Î¾ðÊó¤ä¹½Â¤ÂΤϤ½¤Î¤Þ¤Þ¤Ç¤Ï¥»¡¼¥Ö¤Ç¤¤Þ¤»¤ó¡£¥¯¥é¥¹Æâ¤Ë¤ÏÊ£¿ô¤Î·¿¤âº®ºß¤·¤Æ¤¤¤Þ¤¹¡£
¤³¤¦¤¤¤Ã¤¿¥±¡¼¥¹¤Î¾ì¹ç¡¢¥¯¥é¥¹Æâ¤Î¤½¤ì¤¾¤ì¤Î·¿¤ò¸ÄÊ̤˥»¡¼¥Ö¤·¤Æ¤¤¤Æ¤ÏÈó¾ï¤Ë¸úΨ¤¬°¤¯¡¢¤Þ¤¿¥í¡¼¥É¤ò¹Ô¤¦ºÝ¤Ë¤âÉÔÊؤǤ¹¡£¤Þ¤¿¡¢¥¯¥é¥¹¤Î¾ðÊ󤬤¢¤ë¾ì¹ç¡¢¥»¡¼¥Ö¤¬¹Ô¤¨¤Þ¤»¤ó¡£
¡¡°Ê¾å¤Î¤³¤È¤ò¤Õ¤Þ¤¨¤Æ¡¢¥»¡¼¥Ö¤·¤¿¤¤»þ´Ö¤Î¥¯¥é¥¹¤Î¾ðÊó¤ò£±¤Ä¤Îʸ»úÎó¤È¤·¤ÆºîÀ®¤·¡¢¤½¤Î¾õÂ֤ǥ»¡¼¥Ö¤ò¤·¤Þ¤¹¡£
string ·¿¤Ç¤¢¤ì¤Ð¡¢SetString ¥á¥½¥Ã¥É¤ò³èÍѤ¹¤ë¤³¤È¤Ç¥»¡¼¥Ö¤ò¹Ô¤¨¤ë¤¿¤á¤Ç¤¹¡£
¡¡¤³¤Î¤È¤¡¢¥¯¥é¥¹¤òÉü¸µ¤¹¤ë¤³¤È¤â¹Í¤¨¤Æ¡¢JsonUtility ¥¯¥é¥¹¤òÍøÍѤ·¤Æ¡¢Json ·Á¼°¤È¸Æ¤Ð¤ì¤ë·Á¼°¤Ë§¤Ã¤Æ string ·¿¤òºîÀ®¤·¤Þ¤¹¡£
DateTime ¹½Â¤ÂΤˤĤ¤¤Æ¤Ï ToString ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¡¢¥Õ¥©¡¼¥Þ¥Ã¥È·Á¼°¤ò»ØÄꤷ¤Æ string ·¿¤ËÊÑ´¹¤·¤Þ¤¹¡£
¡¡// ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò Json ·Á¼°¤ËÊÑ´¹ string json = JsonUtility.ToJson(obj); // ¥»¡¼¥Ö¤¹¤ë¤¿¤á¤Î½àÈ÷¡¦¥»¥Ã¥È PlayerPrefs.SetString(key, json);
¡¡SetString ¥á¥½¥Ã¥É¤ÎÂè1°ú¿ô¤¬ Key ¤Ë¤Ê¤ê¤Þ¤¹¡£¥á¥½¥Ã¥É¤Î°ú¿ô¤ÇÆϤ¤¤Æ¤¤¤ë key ¤Î¾ðÊó¤ò¤½¤Î¤Þ¤ÞÍøÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¡SetString ¥á¥½¥Ã¥É¤ÎÂè2°ú¿ô¤¬¥»¡¼¥Ö¤µ¤ì¤ëʸ»úÎã¤Ë¤Ê¤ê¤Þ¤¹¡£
¤³¤³¤Ë Json ·Á¼°¤ËÊÑ´¹¤µ¤ì¤¿¥¯¥é¥¹¤Î¾ðÊó¤Î string ·¿¤ò»ØÄꤷ¤Æ¤¤¤Þ¤¹¡£
¡¡¤³¤ÎÊýË¡¤Ç¥»¡¼¥Ö¤·¤Æ¤ª¤¯¤³¤È¤Ç¡¢¥¯¥é¥¹¤Î¾ðÊó¤ò£±¤Ä¤Ë¥Ñ¥Ã¥±¡¼¥¸¤·¤Æ¥»¡¼¥Ö¤·¤Æ¤¤¤Þ¤¹¡£
¡¡Set ¡Á ¤Ç»Ï¤Þ¤ë£³¤Ä¤Î¥á¥½¥Ã¥É¤Ï¡¢¥»¡¼¥Ö¤ò¹Ô¤¦ÂоݤòÀßÄꤷ¤Æ¤¤¤Þ¤¹¡£¤½¤Î¤¿¤á¥»¡¼¥Ö¤¹¤ë¤¿¤á¤Î¾ðÊó¤ò¥»¥Ã¥È¤·¤Æ½àÈ÷¤ò¹Ô¤¦¥á¥½¥Ã¥É¤Ç¤¹¡£
¼ÂºÝ¤Ë¤Ï¼¡¤Ë²òÀ⤹¤ë Save ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¥Ç¡¼¥¿¤¬¥»¡¼¥Ö¤µ¤ì¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
PlayerPrefs.SetString
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡Set ¡Á ¥á¥½¥Ã¥É¤Ë¤è¤Ã¤Æ½àÈ÷¤µ¤ì¤¿¾ðÊó¤ò¥»¡¼¥Ö¤¹¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
¤³¤Î½èÍý¤¬¼Â¹Ô¤µ¤ì¤Æ»Ï¤á¤Æ¥Ç¡¼¥¿¤¬¥»¡¼¥Ö¤µ¤ì¤Þ¤¹¡£
¡¡Ê£¿ô¤Î Set ¡Á ¥á¥½¥Ã¥É¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤¿¾ì¹ç¡¢¤³¤Î¥á¥½¥Ã¥É¤Ï¤½¤ì¤é¤¹¤Ù¤Æ¤Î¥»¡¼¥Ö¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡// ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò Json ·Á¼°¤ËÊÑ´¹ string json = JsonUtility.ToJson(obj); // ¥»¡¼¥Ö¤¹¤ë¤¿¤á¤Î½àÈ÷¡¦¥»¥Ã¥È PlayerPrefs.SetString(key, json); // ¥»¡¼¥Ö PlayerPrefs.Save();
¡¡º£²ó¤Î¾ì¹ç¤Ë¤Ï¡¢Json ·Á¼°¤Ë¤Ê¤Ã¤Æ¤¤¤ë string ·¿¤Îʸ»úÎó¤Î¾ðÊó¤ò¥»¡¼¥Ö¤·¤Æ¤¤¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
PlayerPrefs.Save
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡Â³¤¤¤Æ¡¢¥»¡¼¥Ö¤µ¤ì¤Æ¤¤¤ë Key ¤Î¾ðÊ󤬤¢¤ë¤«¤É¤¦¤«¤ò³Îǧ¤¹¤ë¤¿¤á¤Î¥á¥½¥Ã¥É¤È¡¢¥í¡¼¥É¤ò¤¹¤ëºÝ¤Î¥á¥½¥Ã¥É¤òÀâÌÀ¤·¤Þ¤¹¡£
¡¡°ú¿ô¤Ë»ØÄꤷ¤¿Ê¸»úÎó¤¬ PlayerPrefs ¤ËÊݸ¤µ¤ì¤Æ¤¤¤ë Key ¤Î¾ðÊó¤È¤·¤Æ¤¢¤ë¤«¤òÄ´¤Ù¤Æ¡¢Key ¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï true¡¢Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï false ¤òÌᤷ¤Þ¤¹¡£
¡¡¡¡public static bool ExistsData(string key) { ¡¡¡¡¡¡¡¡// »ØÄꤷ¤¿¥¡¼¤Î¥Ç¡¼¥¿¤¬Â¸ºß¤·¤Æ¤¤¤ë¤«³Îǧ¤·¤Æ¡¢Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¤Ï true ¡¢Â¸ºß¤·¤Æ¤¤¤Ê¤¤¾ì¹ç¤Ë¤Ï false ¤òÌ᤹ return PlayerPrefs.HasKey(key); }
¡¡º£²ó¤Î¥±¡¼¥¹¤Ç¤Ï¡¢¤³¤Î¥á¥½¥Ã¥É¤òÊ̤Υ᥽¥Ã¥ÉÆâ¤Ëµ½Ò¤·¤Æ¡¢¤½¤Î·ë²Ì¤òÌá¤êÃͤȤ·¤ÆÌ᤹À߷פˤʤäƤ¤¤Þ¤¹¡£
°ú¿ô¤ÇÆϤ¤¤Æ¤¤¤ë Key ¤Î³Îǧ¤ò¹Ô¤¤¡¢¤½¤Î¸ºß¤¬¤Ê¤¤¾ì¹ç(false)¤È¸ºß¤¹¤ë¾ì¹ç(true)¤È¤Ç°Û¤Ê¤ëÃͤòÌ᤹¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
PlayerPrefs.HasKey
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡PlayerPrefs Æâ¤Ë¥»¡¼¥Ö¤µ¤ì¤Æ¤¤¤ë Key ¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¡¢¤½¤Î¾ðÊó¤ò string ·¿¤Ç¼èÆÀ¤¹¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
Âè2°ú¿ô¤òÀßÄꤹ¤ë¤³¤È¤Ç¡¢¤â¤·¤â Key ¤¬Â¸ºß¤·¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï Default ÃͤȤ·¤ÆÀßÄê¤ò¹Ô¤¦¤³¤È¤â½ÐÍè¤Þ¤¹¡£
¡¡
¡¡// ¥»¡¼¥Ö¤µ¤ì¤Æ¤¤¤ë¥Ç¡¼¥¿¤ò¥í¡¼¥É string json = PlayerPrefs.GetString(key);
¡¡¼èÆÀ¤·¤¿¾ðÊó¤Ïʸ»úÎó¤Ç¤¹¤Î¤Ç¡¢¤³¤Î¾ðÊó¤ò¤µ¤é¤ËÊÑ´¹¤·¤Æ¡¢DateTime ¹½Â¤ÂΡ¢¤¢¤ë¤¤¤Ï¤ª»È¤¤¤Î¥Ç¡¼¥¿¤Î¥¯¥é¥¹¤ËÊÑ´¹¤·¤ÆÍøÍѤǤ¤ë¾õÂÖ¤ËÉü¸µ¤·¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
PlayerPrefs.GetString
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡ºÇ¸å¤Ëºï½üÍѤΥ᥽¥Ã¥É¤ò£²¤ÄÀâÌÀ¤·¤Þ¤¹¡£
¡¡PlayerPrefs Æâ¤Ë¥»¡¼¥Ö¤µ¤ì¤Æ¤¤¤ë¾ðÊó¤Ë Key (°ú¿ô¤Ç»ØÄꤷ¤¿Ê¸»úÎó)¤¬Â¸ºß¤·¤Æ¤¤¤ë¾ì¹ç¡¢¤½¤Î¾ðÊó¤òºï½ü¤¹¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
¡¡
¡¡// »ØÄꤵ¤ì¤¿¥¡¼¤Î¥Ç¡¼¥¿¤òºï½ü PlayerPrefs.DeleteKey(key);
¡¡º£²ó¤Î¥±¡¼¥¹¤Ç¤Ï¡¢¥á¥½¥Ã¥É¤Î°ú¿ô¤ËÆϤ¤¤Æ¤¤¤ë Key ¤Î¾ðÊó¤òºï½ü¤¹¤ëÌ¿Îá¤ò¼Â¹Ô¤·¤Æ¤¤¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
PlayerPrefs.DeleteKey
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡PlayerPrefs Æâ¤Ë¥»¡¼¥Ö¤µ¤ì¤Æ¤¤¤ë¤¹¤Ù¤Æ¤Î¾ðÊó¤ò¤Þ¤È¤á¤Æºï½ü¤¹¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£
¤³¤ÎÁàºî¤Ï Unity ¥¨¥Ç¥£¥¿¡¼¤«¤é¼Â¹Ô¤¹¤ë¤³¤È¤â²Äǽ¤Ç¤¹¡£¼ç¤Ë¥Ç¡¼¥¿¤ò¥ê¥»¥Ã¥È¤¹¤ëºÝ¤ËÍøÍѤ·¤Þ¤¹¤Î¤Ç¡¢
¥²¡¼¥à¤Î¥Ç¡¼¥¿¤ò½é´ü²½¤·¤Æ¥Ç¥Ð¥Ã¥°¤ò¹Ô¤¦ºÝ¤Ë¤âÍøÍѤǤ¤Þ¤¹¡£
¡¡
¡¡// ¤¹¤Ù¤Æ¤Î¥»¡¼¥Ö¥Ç¡¼¥¿¤òºï½ü PlayerPrefs.DeleteAll();
»²¹Í¥µ¥¤¥È
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
PlayerPrefs.DeleteAll
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡Unity ¤¬ÍÑ°Õ¤·¤Æ¤¤¤ë Json ·Á¼°¤Î¥Ç¡¼¥¿¤ò°·¤¦¤¿¤á¤Î¥¯¥é¥¹¤Ç¤¹¡£
¥á¥½¥Ã¥É¤ÏÁ´Éô¤Ç£³¤ÄÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
JsonUtility ¥¯¥é¥¹
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡º£²ó¤Ï ToJson ¥á¥½¥Ã¥É¤È¡¡FromJson ¥á¥½¥Ã¥É¤òÍøÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¡ToJson ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢»ØÄꤷ¤¿¥¯¥é¥¹(·¿)¤Î¾ðÊó¤ò string ·¿¤Î Json ·Á¼°¤Îʸ»úÎó¤ËÊÑ´¹¤·¤Þ¤¹¡£
¡¡FromJson ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤Ç¡¢Json ·Á¼°¤Î string ·¿¤Î¾ðÊó¤ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤ÆºîÀ®¤·¡¢»ØÄꤷ¤¿¥¯¥é¥¹(·¿)¤Î¾ðÊó¤ËÊÑ´¹(Éü¸µ)¤·¤Þ¤¹¡£
Ìá¤êÃͤΤ¢¤ë¥á¥½¥Ã¥É¤Ë¤·¤Æ¤¢¤ë¤¿¤á¡¢¤³¤Î¾ðÊó¤òÊ̤Υ¯¥é¥¹¤ËÄ󶡤¹¤ë(¥²¥Ã¥¿¡¼¥á¥½¥Ã¥É¤È¤·¤ÆÍøÍѤ¹¤ë)¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡ãToJson ¥á¥½¥Ã¥É¡ä
/// <summary> /// »ØÄꤵ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò¥»¡¼¥Ö /// </summary> /// <param name="key">¥Ç¡¼¥¿¤ò¼±Ê̤¹¤ë¤¿¤á¤Î¥¡¼</param> /// <param name="isSave"></param> public static void SaveSetObjectData<T>(T obj, string key) { // ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò Json ·Á¼°¤ËÊÑ´¹ string json = JsonUtility.ToJson(obj);¡¡¡¡¡¡//¡¡<=¡¡¤³¤Î½èÍý // ¥»¥Ã¥È PlayerPrefs.SetString(key, json); // ¥»¥Ã¥È¤·¤¿ Key ¤È json ¤ò¥»¡¼¥Ö PlayerPrefs.Save(); }
ToJson ¥á¥½¥Ã¥É
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡ãFromJson ¥á¥½¥Ã¥É¡ä
/// <summary> /// »ØÄꤵ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò¥í¡¼¥É /// </summary> /// <typeparam name="T"></typeparam> /// <param name="key"></param> /// <returns></returns> public static T LoadGetObjectData<T>(string key) { // ¥»¡¼¥Ö¤µ¤ì¤Æ¤¤¤ë¥Ç¡¼¥¿¤ò¥í¡¼¥É string json = PlayerPrefs.GetString(key); // Æɤ߹þ¤à·¿¤ò»ØÄꤷ¤ÆÊÑ´¹¤·¤Æ¼èÆÀ return JsonUtility.FromJson<T>(json);¡¡¡¡¡¡//¡¡<=¡¡¤³¤Î½èÍý }
FromJson ¥á¥½¥Ã¥É
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡C# ¤Ë¤Ï¥¸¥§¥Í¥ê¥Ã¥¯¤È¤¤¤¦µ¡Ç½¤¬¤¢¤ê¤Þ¤¹¡£
¤³¤ì¤Ï»öÁ°¤Ë·¿¤ò»ØÄꤹ¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ëºÝ¤ËǤ°Õ¤Î·¿¤ò»ØÄꤷ¤Æ¼Â¹Ô¤Ç¤¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ëµ¡Ç½¤Ç¤¹¡£
¡¡Æüº¢ÍøÍѤ·¤Æ¤¤¤ë¤â¤Î¤È¤·¤Æ¤Ï GetComponent ¥á¥½¥Ã¥É¤ä¡¢List ¤Ê¤É¤¬¤¢¤ê¤Þ¤¹¡£
GetComponent ¥á¥½¥Ã¥É
https://docs.unity3d.com/ja/current/ScriptReferenc...
¡¡¥¸¥§¥Í¥ê¥Ã¥¯¤Î·¿¤ò¼¨¤¹ÍѸì¤È¤·¤Æ T ¤¬ÍøÍѤµ¤ì¤Þ¤¹¡£¤³¤³¤Ë¤Ï¤É¤Î¤è¤¦¤Ê·¿¤Ç¤â»ØÄꤷ¤Æ¤¤¤¤¤¬¡¢¼Â¹Ô»þ¤Ë¤Ï·¿¤ò»ØÄꤹ¤ë¡¢¤È¤¤¤¦°ÕÌ£¹ç¤¤¤Ç¤¹¡£
/// »ØÄꤵ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò¥»¡¼¥Ö /// </summary> /// <param name="key">¥Ç¡¼¥¿¤ò¼±Ê̤¹¤ë¤¿¤á¤Î¥¡¼</param> /// <param name="isSave"></param> public static void SaveSetObjectData<T>(T obj, string key) { // ¥ª¥Ö¥¸¥§¥¯¥È¤Î¥Ç¡¼¥¿¤ò Json ·Á¼°¤ËÊÑ´¹ string json = JsonUtility.ToJson(obj); }
¡¡¥á¥½¥Ã¥É̾¤È°ú¿ô¤Î´Ö¤Ë <> ¤¬¤¢¤ê¤Þ¤¹¡£¤³¤ÎÉôʬ¤Ï¡Ú·¿°ú¿ô¡Û¤È¸Æ¤Ð¤ì¤ëÉôʬ¤Ç¤¹¡£
GetComponent ¥á¥½¥Ã¥É¤Î <> ¤ÈƱ¤¸¤Ç¡¢¤³¤³¤Ë¡¢·¿¤Î¾ðÊó¤ò»ØÄꤷ¤Þ¤¹¡£GetComponent<Rigidbody>() ¤Î¤è¤¦¤Ë¡¢Ëè²ó·¿¤ò»ØÄꤷ¤Æ½ñ¤¤¤Æ¤¤¤ë¤È»×¤¤¤Þ¤¹¤¬¡¢¤½¤ì¤ÈƱ¤¸¤Ç¤¹¡£
¡¡¤³¤Î¥á¥½¥Ã¥É¤¬¥¸¥§¥Í¥ê¥Ã¥¯¤È¤·¤ÆÀ߷פµ¤ì¤Æ¤¤¤ëÍýͳ¤Ï¡¢¥»¡¼¥Ö¤ò¹Ô¤¦ºÝ¤Ë¡¢¤É¤Î¤è¤¦¤Ê¥¯¥é¥¹¤Ç¤¢¤Ã¤Æ¤â Json ·Á¼°¤ËÊÑ´¹¤Ç¤¤ë¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Ç¤¹¡£
Î㤨¤Ð¡¢·¿¤ò»ØÄꤷ¤Æ¤¤¤ë¾ì¹ç¡¢¤½¤Î·¿¤Ç¤·¤«¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤³¤È¤¬½ÐÍè¤Þ¤»¤ó¡£
¡ã·¿¤ò»ØÄꤷ¤Æ¤¤¤ë¾ì¹ç¡ä
public static void SaveSetObjectData(TapPointDetail obj, string key) {
¡¡¾åµ¤ÎÎã¤Ç¤¢¤ì¤Ð¡¢TapPointDetail ¥¯¥é¥¹¤ò¾ï¤Ë°ú¿ô¤È¤·¤Æ»ØÄꤷ¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤³¤Î¥¯¥é¥¹¤Ç¤¢¤ì¤Ð°ú¿ô¤È¤·¤Æ¼õ¤±Æþ¤ì¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¤¬¡¢
¾¤Î¥¯¥é¥¹¤Ë¤ÏÂбþ¤Ç¤¤Ê¤¤¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¡£¤Ä¤Þ¤ê¡¢ÈÆÍÑÀ¤¬¤Ê¤¤¡¢¤È¤â¸À¤¨¤Þ¤¹¡£
¡¡º£²ó¤Ï¥¯¥é¥¹¤Î¾ðÊó¤ò Json ·Á¼°¤Î string ·¿¤ËÊÑ´¹¤·¤Æ¥»¡¼¥Ö¡¦¥í¡¼¥É¤ò¹Ô¤¦¤³¤È¤¬ÌÜŪ¤Ç¤¹¡£
¤³¤Î¤È¤¡¢ÊÑ´¹¤Ç¤¤ë·¿¤Î»ØÄ꤬¤¢¤ë¤«¤Ê¤¤¤«¤Ë¤è¤Ã¤Æ¡¢¥á¥½¥Ã¥É¤ÎÍøÊØÀ¤¬Â礤¯ÊѲ½¤·¤Þ¤¹¡£
¸ÇÄꤵ¤ì¤Æ»ØÄꤵ¤ì¤¿·¿¤·¤«ÊÑ´¹¤Ç¤¤Ê¤¤¥á¥½¥Ã¥É¤È¡¢¤É¤Î¤è¤¦¤Ê·¿¤Ç¤âÊÑ´¹¤Ç¤¤ë¥á¥½¥Ã¥É¡¢¤Î°ã¤¤¤È¤â¸À¤¨¤Þ¤¹¡£
¤Þ¤¿¡¢¤¤¤º¤ì¤Î¥¯¥é¥¹¤«¤é¤Ç¤â¼Â¹Ô¤Ç¤¤ë¤è¤¦¤Ë static ¤Ê¥á¥½¥Ã¥É¤È¥¯¥é¥¹¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡±¿ÍѤò¹Ô¤¦´ÑÅÀ¤«¤é¹Í¤¨¤ë¤È¡¢TapPointDetail ¥¯¥é¥¹¤ò¸ÇÄꤷ¤Æ¥á¥½¥Ã¥É¤òºîÀ®¤·¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¾ì¹ç¡¢
¤³¤Î¥¯¥é¥¹¤òÊÑ´¹¤·¤Æ¥»¡¼¥Ö¤¹¤ë¤³¤È¤Ï¤Ç¤¤Þ¤¹¤¬¡¢Â¾¤Î¥¯¥é¥¹¤Ë¤ÏÂбþ¤Ç¤¤Þ¤»¤ó¡£
¤½¤¦¤Ê¤ë¤È¡¢³Æ¥¯¥é¥¹¤´¤È¤Ë°ú¿ô¤À¤±¤òÊѤ¨¤¿¥á¥½¥Ã¥É¤òÊ£¿ô¸ÄÍÑ°Õ¤·¤Æ¤ª¤¯É¬Íפ¬À¸¤Þ¤ì¤Þ¤¹¡£
¡¡¤³¤ì¤ÏÈó¾ï¤ËÉÔÊؤǤ¢¤ê¡¢¥á¥½¥Ã¥É¤Î¿ÂÖÀ¤ò¹Í¤¨¤¿¾ì¹ç¤Ë¤âÍý¤Ë¤«¤Ê¤Ã¤Æ¤¤¤ë¤È¤Ï¸À¤¨¤Ê¤¤À߷פǤ¹¡£
¡¡¤½¤Î¤¿¤áº£²ó¤Ï¡¢¥»¡¼¥Ö¤È¥í¡¼¥É¤ò¹Ô¤¦¥á¥½¥Ã¥É¤Ï¥¸¥§¥Í¥ê¥Ã¥¯·¿¤È¤·¡¢½èÍý¤ò¼Â¹Ô¤¹¤ëºÝ¤Ë·¿¤ò»ØÄꤷ¤Æ¤â¤é¤¦¤³¤È¤Ç
¤½¤Î·¿¤ËÂбþ¤·¤Æ½ÀÆð¤Ë½èÍý¤ò¼Â¹Ô¤Ç¤¤ë¤è¤¦¤ÊÀ߷פˤʤäƤ¤¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Ararami StudioÍÍ
C#¤Î¥¸¥§¥Í¥ê¥Ã¥¯¤ò»È¤ª¤¦
https://araramistudio.jimdo.com/2017/12/26/c-%E3%8...
Ķ½é¿´¼Ô¸þ¤±¥×¥í¥°¥é¥ß¥ó¥°ÆþÌç ÍÍ
¥¸¥§¥Í¥ê¥Ã¥¯
https://programming.pc-note.net/csharp/generic.htm...
¡¡°Ê¾å¤Ç´°À®¤Ç¤¹¡£
¤³¤Îµ¡Ç½¤òÍøÍѤ¹¤ë¤³¤È¤Ç¥¯¥é¥¹¤Î¾ðÊó¤ò JsonUtility ¤òÍøÍѤ·¤Æ ¥»¡¼¥Ö¤È¥í¡¼¥É¤¬¹Ô¤¨¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤·¤¿¤Î¤Ç¡¢
¼¡¤Î¼ê½ç¤Ç¤Ï¤³¤Î PlayerPrefsHelper ¥¯¥é¥¹¤òÍøÍѤ·¤Æ¡¢¼ÂºÝ¤Ë¥»¡¼¥Ö¤È¥í¡¼¥É¤Î½èÍý¤òÁȤßΩ¤Æ¤Æ¤¤¤¤Þ¤¹¡£
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯