Unity/helloworld
提供: 初心者エンジニアの簡易メモ
helloworld
- File/new project/2Dを選択
- Assets/Create/C#Script
- 下にcsファイルができるのでHelloworldScript.csへ名前変更
- HelloworldScriptをダブルクリックしてMonoDevelopを開く
using UnityEngine;
using System.Collections;
public class HelloworldScript : MonoBehaviour {
// Use this for initialization
void Start () {
Debug.Log("helloworld");
}
// Update is called once per frame
void Update () {
}
}
- unityの開発画面に戻し、HelloworldScript.csを左上のCanvasへドラッグする
- Canvasを選択し、unityの開発画面の右側のinspectorのScriptにHelloworldScripが関連づけられていることを確認
- 関連づけを削除したい場合は、歯車マークからremoveを選択
実行
- 上部中央の実行ボタンを押す
- 下のconsoleタブにhelloworldが表示されていることを確認
デバッグログが出ない場合
unityメインメニュー/window/general/consoleを開く。
