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

¡¡¤³¤Îµ­»ö¤Ï·¿ÊÑ´¹¤È¡Ö¥­¥ã¥¹¥È¡×¤È¤¤¤¦½ÅÍפʳµÇ°¤Ë¤Ä¤¤¤Æ²òÀ⤷¤Þ¤¹¡£



·¿ÊÑ´¹


¡¡·¿ÊÑ´¹¤È¤Ï¡¢¤¢¤ë¥Ç¡¼¥¿·¿¤«¤éÊ̤Υǡ¼¥¿·¿¤Ø¤ÎÊÑ´¹¤ò»Ø¤·¤Þ¤¹¡£

¡¡Î㤨¤Ðɹ¡Êsolid¡§¸ÇÂΡˤò¿å¡Êliquid¡§±ÕÂΡˤËÊѤ¨¤ë¤è¤¦¤Ê¤â¤Î¤Ç¤¹¡£
¤³¤ÎÊÑ´¹¤Ï³°¸«¤òÊѤ¨¤ë¤À¤±¤Ç¤Ê¤¯¡¢¤½¤ÎÀ­¼Á¡Ê¤³¤³¤Ç¤Ï¾õÂ֡ˤâÊѤï¤ê¤Þ¤¹¡£
¥×¥í¥°¥é¥ß¥ó¥°¤Ç¤âƱÍͤˡ¢°ì¤Ä¤Î¥Ç¡¼¥¿·¿¤«¤éÊ̤Υǡ¼¥¿·¿¤ËÊÑ´¹¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£

¡¡¤³¤ì¤¬¡Ö·¿ÊÑ´¹¡×¤Î´ðËÜŪ¤Ê³µÇ°¤Ç¤¹¡£

¡¡Unity ¤Ç¤¢¤ì¤Ð¡¢Æ±¤¸¿ô»ú¤Ç¤¢¤ê¤Þ¤¹¤¬¡¢°·¤¦·¿¤¬°Û¤Ê¤ë¤¿¤á¡¢
À°¿ô·¿¡Êint¡Ë¤Î¥Ç¡¼¥¿¤òÉâÆ°¾®¿ôÅÀ·¿¡Êfloat¡Ë¤ËÊÑ´¹¤·¤¿¤ê¡¢¤½¤ÎµÕ¤ò¹Ô¤Ã¤¿¤ê¤¹¤ë¤³¤È¤¬¤¢¤ê¤Þ¤¹¡£


·¿ÊÑ´¹¤ÎÊýË¡


¡¡·¿ÊÑ´¹¤Ë¡Ö°ÅÌÛŪ¤ÊÊÑ´¹¡×¤È¡ÖÌÀ¼¨Åª¤ÊÊÑ´¹¡×¤Î£²¤Ä¤ÎÊýË¡¤¬¤¢¤ê¤Þ¤¹¡£


¡ã°ÅÌÛŪ¤ÊÊÑ´¹¡ä


¡¡°ÅÌÛŪ¤ÊÊÑ´¹¤Ï¡¢¥×¥í¥°¥é¥à¤¬¼«Æ°Åª¤Ë·¿ÊÑ´¹¤ò¹Ô¤¦¤â¤Î¤Ç¤¹¡£¾ðÊó¤Î»¼º¤¬¤Ê¤¤¾ì¹ç¡¢¤Ä¤Þ¤ê°ÂÁ´¤Ê¾ì¹ç¤Ë¹Ô¤ï¤ì¤Þ¤¹¡£
¤½¤Î¤¿¤á¡¢ÆÃÊ̤˲¿¤«¤òµ­½Ò¤¹¤ëɬÍפϤʤ¯¡¢¼«Æ°Åª¤Ë·¿¤ÎÊÑ´¹¤¬¹Ô¤ï¤ì¤Þ¤¹¡£

¡¡°Ê²¼¤Î¥³¡¼¥É¤Ç¤Ï int ·¿¤«¤é float ·¿¤Ø¤Î°ÅÌÛŪ¤ÊÊÑ´¹¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

int myInt = 10;
float myFloat = myInt; // °ÅÌÛŪ¤ÊÊÑ´¹­¡
long myLong = myInt; // °ÅÌÛŪ¤ÊÊÑ´¹­¢

¡¡¤³¤ÎÎã¤Ç¤Ï¡¢myInt ¤«¤émyFloat ¤È MyLong ¤Ø¤Î¤Ï¼«Æ°Åª¤Ë¹Ô¤ï¤ì¤Þ¤¹¡£
¤Ê¤¼¤Ê¤é¡¢int¤«¤é float ¤ä long¤Ø¤ÎÊÑ´¹¤Ï¡¢¾ðÊó¤Î»¼º¤¬¤Ê¤¤¤«¤é¤Ç¤¹¡£

¡¡¤³¤ì¤é¤Ïº¸Êդȱ¦Êդη¿¤¬°Û¤Ê¤ê¤Þ¤¹¤¬¡¢¾ðÊó¤Î»¼º¤¬¤Ê¤¤¤¿¤á¼«Æ°Åª¤Ë·¿¤ÎÊÑ´¹¤¬¹Ô¤ï¤ì¤ë¡¢°ÅÌÛŪ¤ÊÊÑ´¹¤Îµ¡Ç½¤Ë¤è¤ëÂåÆþ½èÍý¤Ç¤¹¡£

¡¡·¿¤ËÃÖ¤­´¹¤¨¤Æ¤ß¤ë¤È¡¢¤è¤¯Ê¬¤«¤ê¤Þ¤¹¡£

int myInt = 10;
float = int; // °ÅÌÛŪ¤ÊÊÑ´¹­¡
long = int; // °ÅÌÛŪ¤ÊÊÑ´¹­¢

¡¡º¸Êդȱ¦Êդη¿¤¬°Û¤Ê¤ê¤Þ¤¹¤¬¡¢°ÅÌÛŪ¤ÊÊÑ´¹¤Ë¤è¤ê¡¢ÂåÆþ½èÍý¤¬À®Î©¤·¤Æ¤¤¤Þ¤¹¡£


¡ãÌÀ¼¨Åª¤ÊÊÑ´¹(¥­¥ã¥¹¥È)¡ä


¡¡°ìÊý¡¢ÌÀ¼¨Åª¤ÊÊÑ´¹¤Ï¡¢¥×¥í¥°¥é¥Þ¡¼¤¬ÌÀ³Î¤Ë·¿ÊÑ´¹¤ò»Ø¼¨¤¹¤ë¤â¤Î¤Ç¤¹¡£¤³¤ì¤ò¥­¥ã¥¹¥È¤È¸Æ¤Ó¤Þ¤¹¡£
ÌÀ¼¨Åª¤ÊÊÑ´¹(¥­¥ã¥¹¥È)¤Ï¡¢¾ðÊó¤Î»¼º¤¬µ¯¤³¤êÆÀ¤ë¾ì¹ç¤Ë»ÈÍѤ·¤Þ¤¹¡£

¡¡¥­¥ã¥¹¥È¤Ë¤Ï (T)E ¤È¤¤¤¦½ñ¼°¤¬¤¢¤ê¤Þ¤¹¡£
(T) ¤ËÊÑ´¹¤·¤¿¤¤·¿¡¢E ¤ËÊÑ´¹¸µ¤Ë¤Ê¤ëÊÑ¿ô¤òµ­½Ò¤·¤Þ¤¹¡£

¡¡°Ê²¼¤Î¥³¡¼¥É¤Ç¤Ï float ·¿¤«¤é int ·¿¤Ø¤ÎÌÀ¼¨Åª¤ÊÊÑ´¹(¥­¥ã¥¹¥È)¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£

float myFloat = 10.5f;
int myInt = (int)myFloat;

¡¡(int) ¤ÎÉôʬ¤¬¥­¥ã¥¹¥È¤Î½ñ¼°¤Ë¤ª¤±¤ë (T) ¤Ç¤¹¡£
¤Þ¤¿ myFloat ¤ÎÉôʬ¤¬¥­¥ã¥¹¥È¤Î½ñ¼°¤Ë¤ª¤±¤ë E ¤òɽ¤·¤Æ¤¤¤Þ¤¹¡£

¡¡¤³¤Î¥­¥ã¥¹¥È¤Ë¤è¤ê myFloat ¤ÎÃͤ¬ int ·¿¤ËÊÑ´¹¤µ¤ì¡¢¾®¿ôÉôʬ¤¬ÀÚ¤ê¼Î¤Æ¤é¤ì¤Þ¤¹¡£
¤³¤ì¤¬¾ðÊó¤Î»¼º¤Ç¤¹¡£ËÜÍè¤Ç¤¢¤ì¤Ð»ý¤Ã¤Æ¤¤¤¿¤Ï¤º¤Î¾®¿ôÉôʬ¤Î¾ðÊó¤¬Ìµ¤¯¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤Í¡£

¡¡°ÅÌÛŪ¤ÊÊÑ´¹¤È¤Ï°Û¤Ê¤ê¡¢¥×¥í¥°¥é¥Þ¡¼¤¬½èÍý¤È¤·¤Æ¥­¥ã¥¹¥È¤Î½ñ¼°¤òµ­½Ò¤·¤ÆÊÑ´¹¤ò»ØÄꤹ¤ë¤¿¤á¡¢¡ÖÌÀ¼¨Åª¤ÊÊÑ´¹¡×¤Èɽ¸½¤µ¤ì¤Æ¤¤¤Þ¤¹¡£


¥­¥ã¥¹¥È¤Î¼ÂÍÑÎã


¡¡¤½¤ì¤Ç¤Ï¡¢¼ÂºÝ¤Î¥³¡¼¥ÉÃæ¤Ç¥­¥ã¥¹¥È¤¬¤É¤Î¤è¤¦¤Ë»È¤ï¤ì¤ë¤«¸«¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¤³¤Î¥±¡¼¥¹¤Ç¤Ï¡¢°Û¤Ê¤ë¥Ç¡¼¥¿·¿´Ö¤Ç±é»»¤ò¹Ô¤¦ºÝ¤Ë¥­¥ã¥¹¥È¤¬ÍøÍѤµ¤ì¤Æ¤¤¤Þ¤¹¡£

int totalItems = 9;
int itemsPurchased = 2;

// ¥­¥ã¥¹¥È¤Ê¤·¤Ç·×»»
int percentPurchasedWithoutCast = itemsPurchased / totalItems * 100;
Debug.Log("¥­¥ã¥¹¥È¤Ê¤·: " + percentPurchasedWithoutCast);

// ¥­¥ã¥¹¥È¤¢¤ê¤Ç·×»»
float percentPurchasedWithCast = (float)itemsPurchased / totalItems * 100; 
Debug.Log("¥­¥ã¥¹¥È¤¢¤êt: " + percentPurchasedWithCast);

¡¡¤Þ¤º¥­¥ã¥¹¥È¤Ê¤·¤Ç¥Ñ¡¼¥»¥ó¥Æ¡¼¥¸¤ò·×»»¤·¡¢¤½¤Î·ë²Ì¤ò¥í¥°¤Ë½ÐÎϤ·¤Æ¤¤¤Þ¤¹¡£
¤½¤Î¸å¡¢¥­¥ã¥¹¥È¤ò¹Ô¤Ã¤Æ¥Ñ¡¼¥»¥ó¥Æ¡¼¥¸¤òºÆ·×»»¤·¡¢¤½¤Î·ë²Ì¤ò¥í¥°¤Ë½ÐÎϤ·¤Æ¤¤¤Þ¤¹¡£



¡¡¤³¤Î¥³¡¼¥É¤ò¼Â¹Ô¤¹¤ë¤È¡¢"¥­¥ã¥¹¥È¤Ê¤·" ¤Î½ÐÎÏ¤Ï 0 ¤È¤Ê¤ê¤Þ¤¹¡£
¤³¤ì¤Ï itemsPurchased / totalItems ¤¬À°¿ô·¿¤Ç·×»»¤µ¤ì¡¢¤½¤Î·ë²Ì¤¬ 0¡Ê¾®¿ôÅÀ°Ê²¼¤ÏÀÚ¤ê¼Î¤Æ¤é¤ì¤ë¡Ë¤Ë¤Ê¤ë¤¿¤á¤Ç¤¹¡£

¡¡°ìÊý¡¢"¥­¥ã¥¹¥È¤¢¤ê" ¤Î½ÐÎÏ¤Ï 22.2222222 ¤È¤Ê¤ê¤Þ¤¹¡£
¤³¤ì¤Ï itemsPurchased ¤¬ float ¤Ë¥­¥ã¥¹¥È¤µ¤ì¡¢¤½¤Î·ë²Ì¡¢¾®¿ôÅÀ°Ê²¼¤Î¾ðÊó¤¬ÊÝ»ý¤µ¤ì¤ë¤¿¤á¤Ç¤¹¡£

¡¡¤³¤Î¤è¤¦¤Ë C#¤Ç¤Ï¡¢Æ±¤¸·¿¤ÎÃÍƱ»Î¤Ç³ä¤ê»»¤ò¹Ô¤¦¤È¡¢·ë²Ì¤â¤½¤Î·¿¤Ë¤Ê¤ê¤Þ¤¹¡£
¤Ä¤Þ¤ê¡¢À°¿ôƱ»Î¤Î³ä¤ê»»¤ÏÀ°¿ô¤Î·ë²Ì¤òÀ¸¤à¤Î¤Ç¡¢¾®¿ôÅÀ°Ê²¼¤Î¾ðÊ󤬼º¤ï¤ì¤Æ¤·¤Þ¤¤¤Þ¤¹¡£

¡¡¤½¤Î¤¿¤á¡¢¤³¤³¤Ç¤Ï itemsPurchased ¤ò float ¤Ë¥­¥ã¥¹¥È¤¹¤ë¤³¤È¤Ç¡¢Àµ³Î¤Ê¥Ñ¡¼¥»¥ó¥Æ¡¼¥¸¤òµá¤á¤Æ¤¤¤Þ¤¹¡£


ToString¥á¥½¥Ã¥É¤Ë¤è¤ë·¿ÊÑ´¹


¡¡ToString¥á¥½¥Ã¥É¤Ï¡¢C#¤Î¤¹¤Ù¤Æ¤Î¥Ç¡¼¥¿·¿¤Ç»ÈÍѤǤ­¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£

¡¡»ØÄꤷ¤¿ÊÑ¿ô¤Î·¿¤òʸ»úÎó·¿(string)¤ËÊÑ´¹¤¹¤ë¤³¤È¤¬¤Ç¤­¤Þ¤¹¡£

int myInt = 10;
string myString = myInt.ToString(); // "10"¤È¤¤¤¦Ê¸»úÎó¤Ë¤Ê¤ê¤Þ¤¹

double myDouble = 9.78;
string myDoubleString = myDouble.ToString(); // "9.78"¤È¤¤¤¦Ê¸»úÎó¤Ë¤Ê¤ê¤Þ¤¹

¡¡¤³¤ÎÊýË¡¤Ï¡¢¿ôÃͤòʸ»úÎó¤È¤·¤Æɽ¼¨¤·¤¿¤¤¾ì¹ç¤ä¡¢¿ôÃͤòʸ»úÎóÁàºî¤ÎÂоݤȤ·¤¿¤¤¾ì¹ç¤ËÆäËÊØÍø¤Ç¤¹¡£
UI ¤Ë¿ôÃͤòʸ»úÎó¤È¤·¤Æɽ¼¨¤·¤¿¤¤¾ì¹ç¤ËÍøÍѤ¹¤ë¥±¡¼¥¹¤¬Â¿¤¤¤Ç¤·¤ç¤¦¡£


¤Þ¤È¤á


¡¡°Ê¾å¤¬·¿ÊÑ´¹¤È¥­¥ã¥¹¥È¤Î´ðËÜŪ¤ÊÀâÌÀ¤È¤Ê¤ê¤Þ¤¹¡£

¡¡Æä˥­¥ã¥¹¥È¤ÏC#¥×¥í¥°¥é¥ß¥ó¥°¤Ë¤ª¤¤¤ÆÉÑÈˤËÍѤ¤¤é¤ì¤ë³µÇ°¤Ç¤¹¤Î¤Ç¡¢¤½¤Î»È¤¤Êý¤òÍý²ò¤·¤Æ¤ª¤¯¤³¤È¤ÏÈó¾ï¤Ë½ÅÍפǤ¹¡£
¤·¤«¤·¡¢¥­¥ã¥¹¥È¤Ë¤è¤Ã¤Æ¾ðÊó¤Î»¼º¤¬È¯À¸¤¹¤ë²ÄǽÀ­¤¬¤¢¤ë¤Î¤Ç¡¢¤½¤ì¤ò¾ï¤Ë°Õ¼±¤·¤Æ»ÈÍѤ¹¤ë¤³¤È¤¬µá¤á¤é¤ì¤Þ¤¹¡£

¡¡³Ð¤¨¤Æ¤ª¤¯¤ÈÊØÍø¤Êµ¡Ç½¤Î£±¤Ä¤Ç¤¹¤Î¤Ç¡¢À§È󡢼ºݤ˳èÍѤ·¤Æ¼«Ê¬¤Î¥¹¥­¥ë¤È¤·¤Æ¿È¤Ë¤Ä¤±¤Æ¤¤¤Ã¤Æ¤¯¤À¤µ¤¤¡£

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


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

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

Menu


´ðÁÃ

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

private



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

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