2014-02-01ãã1ã¶æéã®è¨äºä¸è¦§
ã¯ããã« using UnityEngine; public class MyBehaviourScript : MonoBehaviour { private void Start() { // ã¨ã©ã¼ transform.position.x = 0; // OK var pos = transform.position; pos.x = 0; transform.position = pos; // OK transform.position = newâ¦
æ¦è¦ // ãã£ã©ã¯ã¿ã¼ public class Character { public string Name; // åå public int Level; // ã¬ãã« } ä¸è¨ã®ãããªãã£ã©ã¯ã¿ã¼ã®æ å ±ã管çããã¯ã©ã¹ããã£ãã¨ã㦠ãã®ã¯ã©ã¹ã®ã¤ã³ã¹ã¿ã³ã¹ã®æ å ±ããã°ã«åºåãããå ´åã«ä¸è¨ã®ãããªæ§æãæ¸â¦
æ¦è¦ // ã²ã¼ã ãªãã¸ã§ã¯ãã®ã¬ã¤ã¤ã¼ãå¤æ´ãã¾ã gameObject.layer = 8; ã²ã¼ã ãªãã¸ã§ã¯ãã®ã¬ã¤ã¤ã¼ãå¤æ´ãã¦ã©ã®ã«ã¡ã©ã«åãããè¨å®ããå ´å ã¬ã¤ã¤ã¼ã®çªå·ãæå®ãã¾ãããééãããããä½ã®ã¬ã¤ã¤ã¼ãªã®ããããã¥ããã®ã§ ã·ã¼ã³åãã¿ã°åã¨â¦
æ¦è¦ // ã²ã¼ã ãªãã¸ã§ã¯ãããã£ã©ã¯ã¿ã¼ãã©ãã if (gameObject.CompareTag("Character")) { // ... } ã²ã¼ã ãªãã¸ã§ã¯ãã®ã¿ã°ãå¤å®ããå ´åãæååæå®ã§ã¿ã¤ãã»ã¼ãã§ã¯ãªãã®ã§ ã·ã¼ã³åã¨åæ§ã«ã¿ã°åãå®æ°ã§ç®¡çããã¯ã©ã¹ãèªåçæããæ©è½â¦
æ¦è¦ // ã¿ã¤ãã«ç»é¢ã«é·ç§»ãã¾ã Application.LoadLevel("Title"); Unityã§ã¯ä»ã®ã·ã¼ã³ã«é·ç§»ããæã«ã·ã¼ã³ãã¡ã¤ã«ã®ååãæå®ãã¦é·ç§»ãã¾ãã ãã®ã¾ã¾ã ã¨ã·ã¼ã³ãã¡ã¤ã«ãåé¤ãããããªãã¼ã ããã¦ãã¨ã©ã¼ã«ãªãã ã²ã¼ã å®è¡ä¸ã«ä¸è¨ã®ãããªâ¦
æ¦è¦ Unity ã¡ãã¥ã¼ã®ãWindow>Consoleããé¸æã㦠表示ããã Console ã¦ã£ã³ãã¦ã®ãError Pauseãããªã³ã«ãã¾ã ããã§ãUnity ã¨ãã£ã¿ã§ã²ã¼ã åçä¸ã« ã¨ã©ã¼ãä¾å¤ãçºçããå ´åã«ã²ã¼ã ãä¸æåæ¢ããããã¨ãã§ãã¾ã
æ¦è¦ var result = Enum.GetValues(typeof(JobType)).Length; åæåã®è¦ç´ ã®æ°ãåå¾ãããå ´åã¯ä¸è¨ã®æ§æã§åå¾ã§ãã¾ã é¢é£è¨äº
æ¦è¦ var random = new Random(); var result = Enum.GetValues(typeof(JobType)) .Cast<JobType>() .OrderBy(c => random.Next()) .FirstOrDefault(); ã²ã¼ã éçºä¸ã«é©å½ã«ä¹±æ°ã使ç¨ãã¦åä½ç¢ºèªãè¡ãããæã«ä½¿ç¨ãã¦ãã¾ã http://stackoverflow.com/questions/</jobtype>â¦
Unityã¨ãã£ã¿ã®ã¡ãã¥ã¼ãããFile>Build Settings...ããé¸æãã Build Settingsã¦ã£ã³ãã¦ã®ãPlayer Settings...ããé¸æãã Inspectorãã¥ã¼ã®Per-Platform Settingsé ç®ã§ãWeb Playerãã¾ãã¯ãPC, Mac & Linux Standaloneãã®ã¿ããé¸æãã Resolâ¦
Async design with Unity3D from Kouji Hosoda C#ã®Taskã¯ã©ã¹ã¯.NET Framework 4.0以éã§ãã使ããªãã®ã§ Unityã§éåææä½ãå®ç¾ããå ´åã¯èªåã§å®è£ ããå¿ è¦ãããããã§ã Unityã®StartCoroutineã§ãä¼¼ããããªãã¨ã¯å®ç¾å¯è½ã§ãã ã³ã«ã¼ãã³ã¯ããâ¦
http://qiita.com/kyusyukeigo/items/8be4cdef97496a68a39d
using UnityEditor; using System.IO; /// <summary> /// ã¢ã»ãããã¤ã³ãã¼ãããæã®å¦çãè¨è¿°ãã¾ã /// </summary> public class AssetPreprocessor : AssetPostprocessor { /// <summary> /// ãã¯ã¹ãã£ãã¤ã³ãã¼ãããç´åã«å¼ã³åºããã¾ã /// </summary> private void OnPreprocessTextâ¦
é¢é£è¨äº
ä¾ãã°ã¢ã¤ã³ã³ã®ç¨®é¡ã«ãã£ã¦ãã¯ã¹ãã£åãåå¾ãããªã© intåãåæåããã¼ã«ãã¦å¤ãåå¾ãããæã¯ä¸è¨ã®ããã«Dictionaryã使ã£ã¦ãã¾ãã // ã¢ã¤ã³ã³ã®ç¨®é¡ public enum IconType { SOLDIER, // çå½å µå£« SORCERER, // éæ³ä½¿ã } // ã¢ã¤ã³ã³ãã¨â¦
é¢é£è¨äº
Unityã§XMLãèªã¿è¾¼ãé¨åãä½ããã¨èãã¦ã㦠ãResources.Loadã§TextAssetã¨ãã¦èªã¿è¾¼ãã§å¤æããã°è¯ãããªã ã¨æã£ã¦ããã®ã§ãããä¸è¨ã®ã¹ã©ã¤ãã§ããã¯è¯ããªããã¨ã ã¨æ¸ããã¦ãã¦ãã³ã¿ã¾ãã .assetãScriptableObjectã«é¢ãã¦ã¯è©³ãããªãâ¦
private enum State { FADE_IN, IDLE, FADE_OUT, } private readonly StateMachine<State> stateMachine = new StateMachine<State>(); private void Start() { stateMachine.Add(State.FADE_IN, () => {}, () => {}, () => {}); stateMachine.Add(State.IDLE, () => {}, (</state></state>â¦
http://japan.unity3d.com/gallery/made-with-unity/voices/ ç¾å¨ãUnityã®å ¬å¼ãµã¤ãã®ãGallery>Developer's Voiceããã æ ªå¼ä¼ç¤¾Aimingæ§ã¨æ ªå¼ä¼ç¤¾ã¹ãã¤ã¯ã»ãã¥ã³ã½ããæ§ã® Unityã«ãããã²ã¼ã éçºã®ã¤ã³ã¿ãã¥ã¼è¨äºãè¦ããã¨ãã§ãã¾ã å人çã«â¦
ãªãã¸ã§ã¯ãæåã¨ã¯ãµãµã¤ãºã®ããã¡ã¼ã¹ãã¯ã©ã¹ã³ã¬ã¯ã·ã§ã³ãã«ãããã£ã¦ ã³ã¬ã¯ã·ã§ã³ãå®ç¾©ããã¨ãã¯ä¸è¨ã®ãããªã¯ã©ã¹ãä½æããããã«ãã¦ã ã³ã¬ã¯ã·ã§ã³ã®ä¸ãããªãã¸ã§ã¯ããåå¾ãããå ´å㯠Geté¢æ°ãéãã¦åå¾ããããã«ãã¦ããã®ã§ãâ¦
// ã·ã¼ã³ã®åºåºã¯ã©ã¹ abstract class SceneBase { public virtual void Update() { // å ±éå¦ç } } // ã¿ã¤ãã«ã·ã¼ã³ class TitleScene : SceneBase { public override void Update() { base.Update(); // ãããã¡ã³ãããã } } // ã¡ã¤ã³ã¡ãã¥ã¼ã·ã¼â¦