Unityã®2DãuGUIã®ããã©ã¼ãã³ã¹æé©åã«ã¤ãã¦ã®7ã¤ã®Tips
æé©åã¨ããããæ¹åãã話ã§ãã
ã¢ãã¤ã«åãã«ä½ã£ãæã«å¦ã«é ãã£ãå ´åããã®è¾ºãã®è¦å ã絡ãã§ããã±ã¼ã¹ãå¤ãå°è±¡ã§ãããã®è¾ºãã¯ä½ãéã«ç¢ºèªããªããä½ãã¨ãå¾ã çã¿ãå°ãªãã¦è¯ãããªã¨æãã¾ãã
ç®æ¬¡
- ç®æ¬¡
- ãããã¡ã¤ã©ã§ç¢ºèªãã
- DrawMeshãæãã
- ãã£ã«ã¬ã¼ãã«æ°ãã¤ãã
- ãããã«ã¤ãã¦æ³¨æãã¹ãäº
- ãã©ã³ãã®æ±ãã«ã¤ãã¦
- UIãåããï¼å¤å½¢ãããï¼ã³ã¹ãã«ã¤ãã¦
- ç©çæ¼ç®ã«ã¤ãã¦
- ãã®ä»â¦
- Pixel Perfect
- é¢é£
ãããã¡ã¤ã©ã§ç¢ºèªãã
ä½ãã©ãããã«ããããããã¡ã¤ã©ã§æãè² è·ã®ããã£ã¦ããããã«ããã¯ãè¦ã¤ãåºã殺ãå¿ è¦ãããã¾ãã
ããã§CPUã®ã«ã¡ã©ã®è² è·ãé«ããã°Batcheså¨ãããGPUãé«ããã°ãã£ã«ã¬ã¼ããèªä½ã·ã§ã¼ãã¼å¨ãããCPUã®ãã®ä»ãé«ããã°èªåã®ã¹ã¯ãªãããçãæãã§ãã
æ¥ç¶æ¹æ³ã¯ãAutoconnect Profilerã«ãã§ãã¯ãå ¥ã£ã¦ãç¶æ ã§ã¢ããªãèµ·åå¾ãProfilerã®AtiveProfilerããç®çã®ããã¤ã¹ãè¦ã¤ãã¦ç¹ãã ãã§ãã
ã¨ãã£ã¿ä¸ã§åãããããã¡ã¤ã©ã®æ³¨æç¹
ããã§æ³¨æãã¹ãäºã¯ãã¨ãã£ã¿ã¼ã§åçä¸ã®ã²ã¼ã ããããã¡ã¤ã«ããã¨ãã¨ãã£ã¿ã¼ã®æã¤ãã©ã¡ã¼ã¿ã®å¹¾ã¤ããç´ãè¾¼ãäºã§ããä¾ãã°ãã¯ã¹ãã£ã®ã¡ã¢ãªæ¶è²»éãå®éã®ã²ã¼ã ãã¬ã¤ã®ã½ã¬ã¨æ¯ã¹ã¦åã«ãªãã¾ãï¼ã¨ãã£ã¿ã¼ã®æã£ã¦ããã¡ã¢ãªã¨ã²ã¼ã ã®æã£ã¦ããã¡ã¢ãªã表示ãããããï¼
ããã解決ããæãã·ã³ãã«ãªæ¹æ³ã¯ãå®éã«å®æ©ã«è»¢éãã¦ãã¬ã¤ããäºã§ããã§ãããè²ã ãã£ã¦ãã¬ã¤ã§ããªãå ´åãPCåãã«è»¢éãã¦ãã¾ãã¢ã¤ãã£ã¢ãããã¾ããæ®éã®ã²ã¼ã ã¯ãã«ãããã¨å¥ããã»ã¹ã§ã²ã¼ã ãèµ·åããã®ã§ãç¹ã«åé¡ã¯ãªããã¨ãã¡ãã£ã¨Playerlogããã³ã¼ãã¸ã¸ã£ã³ããã«ããã§ããäºç´°ãªåé¡ã§ããã( ËÏË)ï½½ï¾ï½§
ã¡ã½ããæ¯ã®è² è·ã«ã¤ãã¦
åã¡ã½ããå ã®è² è·ã¯Profiler.BeginSampleã§ãããã¡ã¤ã©ã«è¨ä¸ãã¦ãããã¨ãè² è·ã®ç¢ºèªããããããã§ããã¹ã¯ãªããå¨ãã®æé©åã¯ã¾ãä»åº¦ã
æ£ç¢ºãªå¤ãç¥ãããå ´åã¯Instrumentsã使ãã¾ãã
DrawMeshãæãã
DrawMeshã¨ã¯æç»å½ä»¤ã§ããããã¨ã¯æç»æã«ä¸åº¦ã«æç»ããæ©è½ã®äºã§ããåºæ¬çã«GPUã¸OpenGLãéãã¦å½ä»¤ãééããåæ°ã¯å°ãªããã°å°ãªãã»ã©è¯ãã®ã§ãä¸åº¦ã«æç»ã§ãããã®ã¯ä¸åã®å½ä»¤ã§æç»ã§ããããã«ãã¾ãã
ãã®æ©è½ã¯Frame Debuggerã使ç¨ããã¨ãããç´æçã«ç解ã§ãã¾ãã
ä¾ãã°ã ã¨ãçµã¿åããã¦ããã¿ã³ã3ã¤ä½æãã¾ãã
åç´ãªæç»åæ°ãèããã¨ãï¼ï¼) * 3 ãªã®ã§6åã®æç»ã¨èãããã¾ãããå®éã¯åãé層ã®æç»ãã¾ã¨ããããã®ã§ã2åã®æç»ã§å®çµãã¾ãã
ããã¯Unityããããå¦çã§1åã®æç»å ã§æç»åºæ¥ããªãã¸ã§ã¯ãã¯ãèªåçã«ã¾ã¨ãã¦æç»ãã¦ãããçºã§ãããã®åæ°ã¯FrameDebuggerã¨Statsã®Batchesã§ç¢ºèªåºæ¥ã¾ãã
ãããã¯ããè¤éãªå½¢ç¶ãUIå士ãå¤å°éãªã£ã¦ãã¦ãåæ§ã«ä½ç¨ãã¾ããã§ãããä¸åº¦ã«æç»ã§ããªãâ¦ä¾ãã°ãªãã¸ã§ã¯ããå ¥ãåæ ã£ã¦ããå ´åã¯ä¸æ¬ã§æç»ããäºã¯ã§ãã¾ããããããã¯ããã¾ã§ãä¸åº¦ã«æç»ã§ããã®ããã«æ©è½ãããããè¤æ°ã®é層ãæã¤å ´åã¯ä¸æ¬ã§æç»ããäºãã§ãã¾ããã
ä¾ãã°ãä¸ã®DrawMesh2åã¨DrawMesh4åã®éããè¦ã¦ã¿ã¾ãã
 ãããã³ã°ãããªãè¬ã®çç±
ä½æ ãããªäºãèµ·ããã®ãã
ãã¤ã³ãã¯ãã®ä¸ã«ãæç»ãã¦ããäºã§ããæç»é ã¯ãå ã«æç»ãã¦ãæç»ããã®ããããã®ä¸ã«ããããããä¸æ¬ã§æç»åºæ¥ãªãäºã«åé¡ãããã¾ããFrame Debuggerã§ç¢ºèªãã¦ã¿ã¾ãã
 ãããã³ã°ããããããçºã«ã¯
ãã®è§£æ±ºæ³ã¯2ã¤ããã¾ãã
ä¸ã¤ã¯æç»é ãå ¥ãåã«ãªããªãããã«èª¿æ´ãããã¨ã§ããå ¥ãåã«ãªãããããªããã°ãæç»åæ°ã¯ä¿ããã¾ãã
2ã¤ç®ã¯ã¨ãåããã¯ã¹ãã£ã«æ ¼ç´ããäºã§ããTexturePackerãUnityæ¨æºã®SpritePackerã§ã¹ãã©ã¤ããä¸ã¤ã®ãã¯ã¹ãã£ã¸æ ¼ç´ããããããåå¾ããå½¢ã§è¡¨ç¾ããäºã§ã1åã®DrawMeshã§å ¥ãåæ§é ãªã¹ãã©ã¤ããæç»åºæ¥ã¾ãã
ãã£ã«ã¬ã¼ãã«æ°ãã¤ãã
ãã£ã«ã¬ã¼ãã¨ã¯ã1ç§è¾ºãã«ä½ãããæç»ããäºãã§ããã®ããã¨ããäºã§ãã2Dã§ã3Dã§ãç»é¢ã«ä½ããã®ãªãã¸ã§ã¯ããæç»ããã«ã¯è²ãå¡ãå¿ è¦ãããã£ã¦äºã§ãã
ããã®ä½ãåé¡ãã¨è¨ãã°è³æ¥µåç´ãã¢ãã¤ã«ã®çã£ã解å度ã«å¯¾ãã¦GPUã貧弱ãªçºãç»é¢ãä½åº¦ãæç»ãããããªäºãããã¨æç»ã追ãã¤ããªãã¦æ»ã¬ã£ã¦äºã§ãã
ãããããã£ã«ã¬ã¼ãã§æ»ã¬ãã¿ã¼ã³
ä¾ãã°ãä¸ã®ãããªããã£ã©ã¯ã¿ã¼ã®åã«æ ããããçµµãããã¨ãã¾ããä¸è¦ãåé¡ãç¡ãããã«è¦ãã¾ãããå®éã¯éæãªé¨åããéæã§æç»ãããã¦ããããã£ã«ã¬ã¼ããããªãå§è¿«ããã¾ãã
ä½åº¦ãæããã¦ããé¨åã¯SceneViewã®Overdrawã§ç¢ºèªããäºãã§ãã¾ããæããè²ã¯ã¤ãã¤æã§ããæãã¤ãã¤ã®ã¯ç½ãé¨åã§ããã¼ãã£ã¯ã«ãããå§ãã人ã¯å¤§ä½ãããä½ãããã¼ãã£ã¯ã«ã®ããã©ã¼ãã³ã¹ãæªããã¨åéããã¾ããï¼ãã¼ãã£ã¯ã«ã§ããã©ã¼ãã³ã¹åºããããã°ã大ããå°ãªããã¨èªèãã¦ã¾ãï¼
ãã£ã«ã¬ã¼ã対ç
ãã£ã«ã¬ã¼ã対çã§ãããUnity 2Dã¨uGUIã§ã¯è¥å¹²å¯¾å¿ãç°ãªãã¾ãã
uGUIã«ããããã£ã«ã¬ã¼ã対ç
ã¾ãuGUIã§ãããä¸å¤®ãå¨å²ã®è²ãä¸è¦ãªç®æãæãåãã¾ããããæ¹ã¯Sprite Editorã§ã¹ã©ã¤ã¹ãè¡ãæãã§ããå¤æ ãåããããªãSingleã§ã¯ãªãMultiã§è¡ãã¾ãã
Unityã®uGUIã¨Imageã¨Spriteã¨ã¹ã©ã¤ã¹ã«ã¤ã㦠- ãã©ã·ã¥ã¼ã«ããã°
ã¹ã©ã¤ã¹å¾ãImageã®ImageTypeãSlicedã«è¨å®ããã¨FillCenterã®ãã§ãã¯ãå¤ãäºã§ãä¸å¤®ãå¡ãããªããªããã£ã«ã¬ã¼ãã®ç¯ç´ã«ãªãã¾ãã
Unity 2Dã«ããããã£ã«ã¬ã¼ã対ç
Unity 2Dã®å ´åã¯å°ãæ¯è²ãç°ãªãã¾ããUnity 2Dï¼Sprite Rendererï¼ã§æç»ãããªãã¸ã§ã¯ãã¯ãèªåçã«ã¹ãã©ã¤ãã®å½¢ç¶ã«ããªã´ã³çã«ç¹°ãæããéæé¨åãæä½éã®ç¶æ ã§æç»ããã¾ãã
解å度ãä¸ãã
ã¡ãªã¿ã«ããããã¨ã¯å¥ã«ãã£ã¨æã£åãæ©ããã£ã«ã¬ã¼ãã稼ããããã°è§£å度ãä¸ããã®ãä¸çªæ¥½ã§ãã
åç´ã«ãæç»ç¯å²ãååã«ãªãã°æç»ãã¹ãç¯å²ã¯1/4ã«ãªãã¾ããå ã ãã«è§£å度ã®ãªã½ã¼ã¹ãªãã¦ç¨æãã訳ãç¡ãã®ã§ãç¨æãããªã½ã¼ã¹ã«è¦åã解å度ã«èª¿æ´ããäºã§ãããªãã®ãã£ã«ã¬ã¼ãã稼ããã¨ãåºæ¥ã¾ãã
解å度ãä¸ãã¦ããã©ã¼ãã³ã¹ãå¾ã - ãã©ã·ã¥ã¼ã«ããã°
 ã²ã¼ã ç»é¢ã¯ä½è§£å度ãUIã¯é«è§£å度
ã¾ãä½è§£å度ã®RenderTextureã«ã²ã¼ã ç»é¢ãæç»ãUIã«æç»ããã¨ãã£ãææ³ãã¢ãªã¨è¨ãã°ã¢ãªã§ãã
ãã®ææ³ã¯UIï¼ã¨ãããæåï¼ãæ½°ããã®ãå«ãªå ´åãããããçµµç´ æ使ã£ã¦ããã®ã«ããã¹ãã¯ãã«è§£å度ãªã¨ã»8bitã²ã¼ã ï¼ãã¯ã»ã«ã¢ã¼ãï¼ãªã²ã¼ã ãä½ãããå ´åãããç»é¢ãåãå°½ãã馬鹿ã¿ããã«éãããããαä»ãç»åãããç¡é§ã«ãªãããªã¤ã¡ã¼ã¸ã¨ãã§ã¯ãããããå ´åã«æå¹ã§ãã
ä¸ããã¼ãã£ã¯ã«ã1000000åã»ã©åºããçµµãä¸ã¯ãããä½è§£å度ãªRenderTextureã§æç»ããçµæã§ãã極端ã«æç»è² è·ãããã¦ããå ´åã¯å²ã¨å·®ãã§ã¾ãããããã§ãªãå ´åã¯ããã¾ã§é²éª¨ã«å·®ã¯åºã¾ããã
Overheadã¨RenderTextureã³ã¹ãããã¨çµå±ã¯ï¼åã¯å ¨ç»é¢æç»ãã¦ããç¹ã§ä½¿ç¨ä¸è¦ãå¤æããã¨è¯ãããã§ãã
ç¹ã«ä»å¾ã¯3Dãåºæ¬ã·ã§ã¼ãã¼ãªããã§ImageEffectä»ããªãã¨ã·ã§ãã¤ã¨ããçµµãå¢ããã¨æãã®ã§ããã®ææ³ã¯ã¢ãªãããªãããªã¨æãã¾ãã
解å度æ¦äºæ©ãçµããã
ãããã«ã¤ãã¦æ³¨æãã¹ãäº
ã¹ãã©ã¤ãã¯ãããã³ã°ãè¡ããã¨ã§å¹ççã«æç»ã§ãã¾ãããã¹ãã©ã¤ãã®æ°ã大éã«ããå ´åããããã³ã°ãå¹ãã¦ããã®ã«Batchesãå¢ããäºãããã¾ãã
ããã¯ã1åã«ã¾ã¨ããããæ大æ°ã900é ç¹ã¾ã§ï¼UV使ããã®ã¯300ï¼ãã¨ããä»æ§ï¼ããã©ã¼ãã³ã¹çã«ã¯ç¡éã«ãããã³ã°ããããããç¨åº¦çºã£ãã次ã®ãããããã»ããè¯ãï¼ã«å¯ãèãæ¹ã§ãã
Unity - ããã¥ã¢ã«: ããã¼ã³ã¼ã« ãããã³ã°
Unity 2Dã®ã¹ãã©ã¤ãã«ä½¿ç¨ããé ç¹ã¯é«è§£å度ãªUIç¨ï¼ç¶ºéºã«æãåãçºã«ï¼é«ããªãå¾åã«ãããé«è§£å度ãã¤å¤§éã«é ç½®ããã¨å²ã¨ç°¡åã«Batchesãå¢ããã¦ããã¾ãã
ãã®å ´åãMeshTypeãFullRectã«è¨å®ãã¹ãã©ã¤ãã®ããªã´ã³çæãæ¢ããã®ãã²ã¨ã¤ã®æããããã¾ããã
ã¾ããããã³ã°ã¯æç»ãã¾ã¨ãã¦ãããæ©è½ã§ããããã®ãã¾ã¨ããå¦çãã«ãCPUã使ç¨ãã¾ãããã®ãããããã¯ããç¨åº¦ã®ç²¾åº¦ã¯ç¡è¦ãã¦ãããã¾ãããããã³ã°ãå¹ãã«ããã²ã¼ã ã¯éã«ãããã³ã°ãåã£ãæ¹ãããã©ã¼ãã³ã¹ãä¸ãããã¨ãããã¾ãã
ä»ã«ããRenderTextureã«ãªãã¹ã¯ãªã¼ã³ã§èæ¯ãæç»ãã¦ä½¿ãã¾ããææ³ããã¹ãã©ã¤ãã¡ãã·ã¥ã®çµåããªã¯ã«ã¼ã¸ã§ã³ããªã³ã°ã®2Dçã¨ãã£ããæç»åæ°ãæ¸ããã¢ããã¼ãã¯è²ã ã¨ããã¾ããããããã£ãææ³ã¯åºæ¬çã«ä½ãã¨ãã¬ã¼ããªãã§ããå®éã«å¹æãããã®ããããã¡ã¤ã©ã§ç¢ºèªããªãã試ãã®ãè¯ãããã§ãã
ãã©ã³ãã®æ±ãã«ã¤ãã¦
Unityã¯ä½æé ããããã¤ãããã¯ãã©ã³ããåå¾ãã TrueType Fontsãããã¯OpenType Fontsãå®è¡æã«ã¬ã³ããªã³ã°ãåå¾ã§ããããã«ãªãã¾ããã
ããã«ããè¨å¤§ãªæåæ°ãèªãæ¥æ¬èªã§æåç¯å²ãå¶éãããã¨ç¡ããæåã使ãã¾ããã£ã³ãã£ã³â¦ã¨ã¯è¡ãã¾ããã
確ãã«ãã¤ãããã¯ãã©ã³ãã使ç¨ãããã¨ã§ä½¿ç¨ã§ããæåæ°ã®å²ã«ã¢ããªãµã¤ãºãå¤§å¹ ã«æ¸ãããã¨ãå¯è½ã¨ãªãã¾ããããåæã«æåã®ã¬ã³ããªã³ã°ã³ã¹ããçºçãã¾ãã
ãã¦ãæ¬æ¥æ¥æ¬èªã使ç¨ã§ããªãOpenGLä¸ã§ã©ããã£ã¦æ¥æ¬ã®æåã表ç¾ãã¦ããã®ãã¨ããã¨ãåç´ã«ãã©ã³ãããã¯ã¹ãã£ã¸ã¬ã³ããªã³ã°ãã¦è¡¨ç¾ãã¦ãã¾ãã
Unity4ã®ãã¤ãããã¯ï¼or ã·ã¹ãã ï¼ãã©ã³ãã使ã - ãã©ã·ã¥ã¼ã«ããã°
ãã¯ã¹ãã£æ´æ°æã®ã¹ãã¤ã¯
ããã®åé¡ã¯ãæåæ°ãå¤ããªã£ãæã§ããæåæ°ãå¢ããã¨ããã®ãã©ã³ãã¯ä½¿ã£ã¦ããªãæåãåé¤ãã¦ãã©ã³ãã®ãã¯ã¹ãã£ãä½ãç´ãã¾ãããã®éããµã¤ãºã2048x2048ã¿ãããªãµã¤ãºã«ãªã£ã¦ããã¨ãå²ã¨å¼·åãªã¹ãã¤ã¯ã¨ãªãã¾ãã
ããã¯åç´ã«èããã°ããã¾ã§çºçããªãããã«æãããããã¾ããããã¢ãã¤ã«ã®UIåãã«å¤§ããã®ãã©ã³ãã使ç¨ãã¦ãããã«ã¨ãã§ã¯ãç¨ã®å·¨å¤§ãªæåã使ç¨ããã¨ç°¡åã«èµ·ããã¾ãã
2ã¤ã®å¯¾ç
ããã®å¯¾ææ¡ã¨ãã¦ã¯2ã¤ã®ã¢ã¤ãã£ã¢ãããã¾ãã
ä¸ã¤ã¯FontãDynamicã§ã¯ãªãUnicodeçãæå®ãããã¨ã§ããããã§äºåã«ãã©ã³ããã¬ã³ããªã³ã°ãã¦æä¾ããï¼æè¬BMPãã©ã³ãã¿ãããªæãï¼ã®ã§ãã¬ã³ããªã³ã°æã«çºçããã¹ãã¤ã¯ã¯æãããã¾ãã
Unity - ããã¥ã¢ã«: ãã©ã³ã
ããä¸ã¤ã®ã¢ã¤ãã£ã¢ã¨ãã¦ã¯å°ã ããªããã¼ã§ãããåããã©ã³ãããµã¤ãºå¥ã«ç¨æããäºã§ãã大ããªãã©ã³ãã¯åºæ¬çã«ä¼¼ããããªæåãã使ç¨ãããå°ãããã©ã³ãã¯ä¼è©±ããã¤ã¢ãã°ã«ä½¿ç¨ããã¨ãã£ãå½¢ã§éç¨ãã¾ãã
2ã¤ã®ãã©ã³ãã使ãåãããã¨ã§ã大ããªãã©ã³ããå ´æãåããå°ãããã©ã³ãã大ãããã©ã³ããæ¼ãåºããããã«å¤§ãããã©ã³ããå ´æãåãï¼ã¹ãã¤ã¯çºçï¼â¦ã¨ãã£ãæµããé²ãäºãã§ãã¾ãã
UIãåããï¼å¤å½¢ãããï¼ã³ã¹ãã«ã¤ãã¦
è¤éãªUIãä½æããå¾ãUIãåããã¨Canvas.BuildBatchãèµ°ããã«ã«åºæ¥ãªãè² è·ã«ãªããã¨ãæãã¾ããããã¯ãä¾ãã°ã¹ã¯ãã¼ã«ãã¥ã¼çã ãåãããããââLayoutãèµ·åãã£ã±ãªãã«ããã¨çºçãããã¨ãããã¾ãã
ããã¯ä½ãã¨ããã¨ãã©ããCanvasã¯ä¸åº¦Canvaså ã®UIï¼CanvasRendererï¼ãåéããã«ãããï¼ä¸ã¤ã®ã¡ãã·ã¥åããï¼äºã§ããã©ã¼ãã³ã¹ã®æé©åãå³ã£ã¦ãããããã1åã§ãUIãåãã¨Canvaså ã®UIãååéãã¦ä½ãç´ãâ¦ã¨ãã£ãäºãè¡ãã¿ããã§ãããã®ããã常ã«åãã¦ããUIãå«ã¾ãã¦ããå ´åããããé«ãã³ã¹ãã«ãªãã±ã¼ã¹ãæãã¾ããï¼World Spaceã§æå®Canvasã®UIã®ä¸é¨ã§ãå ¥ãã¨å ¨é¨ã®UIã表示ããã¦ãã¾ãã®ã¯ãã®ããã§ãï¼
ãã®å¯¾çã¨ãã¦ã¯ãå¹¾ã¤ãã®ã¢ã¤ãã£ã¢ãããã¾ãã
ã¾ããåããUIã®è¦ªã«Canvasã³ã³ãã¼ãã³ãã追å ããäºãããã§ãããã³ã°ã«ããä¸æ¬æç»ãã§ããªããªãã¾ãããCanvas.BuildBatchã¯è»½ããªãã¾ãã
ãªã¹ããã¥ã¼ã®ãããªè¦ç´ ã«é¢ãã¦ã¯ãNGUIã®ãªã¹ããã¥ã¼ã¨åãããã«ãCanvasã®World Spaceã§è¦ç´ ã®ä¸é¨åãåå¾ãæç»ããã¢ã¤ãã£ã¢ãããã¾ãã
ã¾ãããã£ãUnity 2Dã使ã£ã¦UIã®åãè¦ç´ ã表ç¾ããã¢ã¤ãã£ã¢ãããã¾ãã
â»ãã®è¾ºãã¯Unity 5.2ã§ããªãæé©åãå ¥ãã¾ããã
ç©çæ¼ç®ã«ã¤ãã¦
è²ã ã¨æ¤è¨¼ãã¦ããæãã§ãã¨ãUnity 2Dã®rigidbody2dã¯ç¢ºãã«ã2dã§ç©çæ¼ç®ããããå ´åã«æãå¹ççã«åãã¦ãããã®ã§ãããã©ããããã¬ã¤ã¤ã¼ãç©çæ¼ç®ã使ããåããããå ´åãã¯PhysX3(rigidbody)ã®æ¹ãé«éã§åãã¦ãããæ°ããã¾ããå¼¾å¹ã¨ãã¯ã¡ããã¨ä½ãã人ã¯èªåã§ã¹ã¯ãªããæ¸ããã»ããéããªãããã§ãã
https://t.co/SlWfe0yAOm Unity ã§å¤§éã®ãªãã¸ã§ã¯ããæç»ããã¹ã¯ãªãããå
¬éãã¾ããã ãã¨ãã®æè¡è§£èª¬ http://t.co/hdGdc3UOXF pic.twitter.com/8qV7j23shX
â i-saint (@i_saint) 2015, 2æ 8
 å°è±¡ã¨ãã¦ã¯ããããªæãã§ãã
2Dåãç©çï¼åç©çï¼
ãârigidbody2d + collider2D
ããããã㯠rigidbody2d(velocity ç´å¼ãï¼ï¼collider2D
ç©çç¡ã2Dåããè¤éãªå½¢ç¶ã®å½ããå¤å®
ãârigidbody(isKinematic) + colliderï¼ã¤ãã³ãã使ãããå ´åï¼
ããããã㯠collider + Physics.OverlapSphere
ããããã㯠collider + rigidbody ( velocity ç´å¼ãï¼
ãã®ä»ãã·ã³ãã«ãªå½¢ç¶ãåãå¤ã
ãâcollider + rigidbody or Physicsç³»ã
ãããããã¯èªä½ï¼ä½ããã®ã«ããï¼
Â
ç¹ã«ââCollider2Dã·ãªã¼ãºã¯rigidbody2dæãã§åãããå ´åã®ããã«ãã£ãè´å½å·ã¬ãã«ãªã®ã§ãrigidbodyæãã®å ´åã¯ï¼rigidbody2dã®isKinematicã使ã£ãå ´åã§ãï¼colliderã§å¶å¾¡ããæ¹ãè¯ãããã§ãã
ããã©ã¼ãã³ã¹ãåºãªããã°Timeã®FixedTimeStepãè½ã¨ãã¾ãããã
ã¡ãªã¿ã«Transformã§åãããå ´åã¯ãç©çæ¼ç®çãªãã¦ã³ããåºæ¥ãªãã®ã§åçç¡ç¨ã§ããè¾¼ã¿è²«éãããããå£ã貫éãã¦èµ°ããã¯ãããè¦ãã®ã§ä¸å¿â¦
Â
ãã®ä»â¦
VSYNCã«ã¤ãã¦
vsyncã¯ONã«ããã»ããé»æ± ã¨ãè²ã ã¨è¯ããããã§ãããã¨ãã¬ã¼ã ã¬ã¼ããdon'tsyncã¨æ¯ã¹ã¦å®å®ãã¾ãï¼ã«ã¯ã¤ãã«ãããªãï¼ãå¤åã
åæå¤ã¯Don't syncãªå ´åããã£ããç¡ãã£ããã
Tweenã¨ã
DOTweenãè¯ãããã§ãã
Â
åºæ¬çã«æé©åã¯ä½ãã¨ã®ãã¬ã¼ããªãã ã¨æãã®ã§ãã³ã³ã§æ¸ããã¡ã¢ä»¥å¤ã«ãè²ã ã¨è©¦ãã¦ã¿ãã¨è¯ãã¨æãã¾ããï¼åºæ¥ãã°ã¢ããã¼ãã¯ã·ã§ã¢ãã¦ãããã¨å¬ããã§ãï¼
Pixel Perfect
åããã¨é¦¬é¹¿ã«ãªããªãã³ã¹ããæ¥ã¾ããåãããªãPixel Perfectã¯åã£ã¦ããåããã®ãè¯ãããã§ãã
ScreenSpace-Cameraã使ç¨ããç¶æ ã§Cameraãåãã
UIãåæ§ç¯ãããã®ã§ãçµæ§é«ãè² è·ãè¿ã£ã¦ãã¾ãã
åããã«ã¡ã©ã«ScreenSpace-Cameraãè¨å®ããã®ã¯æ¢ããæ¹ãè¯ãããã§ãã
RectMask2Dã使ã
---
é·ãã®ã§ä¸æ¦ããã¾ã§ã
ã¹ã¯ãªããç·¨ã¯ã¾ããã®ãã¡ã