-
-
Save peroon/2d7815b4ed8a009457503b1d257378e4 to your computer and use it in GitHub Desktop.
SetPass CallとFPSの関係を調べる.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.UI; | |
| using System.Collections; | |
| public class Test : MonoBehaviour { | |
| public GameObject meshPrefab; | |
| public Transform cubeRoot; | |
| public InputField generateNum; | |
| void Start () { | |
| } | |
| void Update () { | |
| } | |
| public void OnClickGenerate(){ | |
| // 数値 | |
| int num = int.Parse(generateNum.text); | |
| Debug.Log (num + "個生成します"); | |
| // 子供全削除 | |
| foreach (Transform t in cubeRoot) { | |
| Destroy (t.gameObject); | |
| } | |
| // 生成 | |
| for (int i = 0; i < num; i++) { | |
| // 位置 | |
| var t = i / (float)num; | |
| float x = Mathf.Lerp(-8.0f, 8.0f, t); | |
| float y = 4.0f * Mathf.Sin (i / 10.0f); | |
| var position = new Vector3 (x, y, 0); | |
| var go = Instantiate (meshPrefab, position, Quaternion.identity) as GameObject; | |
| go.GetComponent<Renderer> ().material.color = new Color (Random.value, Random.value, Random.value); | |
| // 親につける | |
| go.transform.SetParent (cubeRoot); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment