facebook twitter hatena line email

Unity/helloworld

提供: 初心者エンジニアの簡易メモ
2017年9月12日 (火) 17:20時点におけるAdmin (トーク | 投稿記録)による版 (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が表示されていることを確認

参考

http://m0kichiazuma416.blog.fc2.com/blog-entry-84.html