コミカルな金魚たちがワラワラと登場します。
アプリ基本情報
- アプリ名:金魚すくって
- カテゴリ:ゲーム
- 価格:無料
- App Store :https://itunes.apple.com/jp/app/id531131294?mt=8
// Transform型を渡す方法 gameObjA.transform.LookAt(gameObjB.transform); // Vector3型を渡す方法 gameObjA.transform.LookAt(gameObjB.transform.position);こうすることでgameObjAの「前」が、gameObjBの方へ向きます。
if (Input.GetKeyDown("a")) {
// aが押された!(押され続けは検知されない)
}
if (Input.GetButtonDown("Fire1")) {
// Fire1が押された!(押され続けは検知されない)
}
GetButtonDown("Fire1")で入力を受け付けるキーは、Edit > Project Settings > Inputメニューから開くInput Managerの中でマッピングされています。Debug.Log(renderer.GetType().FullName);
UnityEngine.MeshRenderer UnityEngine.Debug:Log(Object)
using UnityEngine;
using System.Collections;
public class ScriptObjTest : MonoBehaviour {
int count = 0;
void Start () {
// 描画をしないだけなので、Update()関数は呼ばれ続ける。
renderer.enabled = false;
}
void Update () {
++count;
Debug.Log("count = "+count);
}
}
rendererはGameObjectが保持しているMeshRendererオブジェクトです。static function Range (min : float, max : float) : float; static function Range (min : int, max : int) : int;しかし、floatとintの場合では、max値の扱いが違うようです。
Resources.Load("dataname");
で行う事ができます。/Resources/Prefabs/Beeスクリプトは以下のように変わります。
using UnityEngine;
using System.Collections;
public class Startup : MonoBehaviour {
int count = 0;
float t = 0;
string fpsInfo = "";
public GUIStyle fpsStyle;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
t += Time.deltaTime;
++count;
if (t>=1.0) {
fpsInfo = "fps: "+count;
t = 0;
count = 0;
}
}
void OnGUI() {
GUILayout.Label(fpsInfo,fpsStyle);
}
}
※ネット上にある Unity のサンプルスクリプトが Javascript で書かれてることが多いので、C# で書こうとすると、初心者には途方に暮れてしまうことがありますが、関数名はそのままでコンバートすれば、だいたい大丈夫なようです。