Quantcast
Viewing latest article 8
Browse Latest Browse All 16

How set position of spawning clones

Please help, how I can set spawning position (now is: 0, 0, 0) for below inscribed code. I walked through the tutorials but without result. Everything what I trying causing crash of structure Xn x Yn. Thank you very much using UnityEngine; using System.Collections; public class Spawn : MonoBehaviour { public GameObject Prefab; public float timer = 0f; public float time_of_spawn = 0f; public int Xn; public int Yn; void Update() { timer += Time.deltaTime; if (timer > time_of_spawn) { for (int x = 0; x < Xn; x++) { for (int y = 0; y < Yn; y++) { Instantiate(Prefab, new Vector3 (x, y, 0f), Quaternion.identity); timer = 0f; } } } } }

Viewing latest article 8
Browse Latest Browse All 16

Trending Articles