- Home /
Question by
up814853 · Jan 14, 2019 at 09:17 PM ·
instantiatenoobsample
Why is unity crashing?,How is this crashing unity?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RANDSPAWN : MonoBehaviour
{
public GameObject GO;
public Transform prefab;
// Start is called before the first frame update
void Start()
{
for (int i = 0; i < 10; i++)
{
Instantiate(prefab, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);
}
/*
for (int a = 0; a < 10; a++)
{
for (int b = 0; b < 10; b++)
{
for (int c = 0; c < 10; c++)
{
Instantiate(GO, new Vector3(a,b,c), Quaternion.identity);
// clone.transform.position = Vector3.Lerp(clone.transform.position, new Vector3(a, b, c), Time.deltaTime);
}
}
}
*/
}
// Update is called once per frame
void Update()
{
}
}
Above is a complete copy and paste of my code. I am just trying to test loop and lerp stuff, so an object spawns and goes to its position so I can see a cube being made and seeing if its hollow or not. However whenever I run this code it complete crashes out unity, using System.Collections; using System.Collections.Generic; using UnityEngine;
public class RANDSPAWN : MonoBehaviour
{
public GameObject GO;
public Transform prefab;
// Start is called before the first frame update
void Start()
{
for (int i = 0; i < 10; i++)
{
Instantiate(prefab, new Vector3(i * 2.0F, 0, 0), Quaternion.identity);
}
/*
for (int a = 0; a < 10; a++)
{
for (int b = 0; b < 10; b++)
{
for (int c = 0; c < 10; c++)
{
Instantiate(GO, new Vector3(a,b,c), Quaternion.identity);
// clone.transform.position = Vector3.Lerp(clone.transform.position, new Vector3(a, b, c), Time.deltaTime);
}
}
}
*/
}
// Update is called once per frame
void Update()
{
}
}
As you can see instantiate prefab is from the tutorial and that is crashing mine and a friends unity install is there anything I am doing wrong?
Comment
Your answer

Follow this Question
Related Questions
Spawning an instance of a prefab no longer works 0 Answers
Issue With Spawning Enemies (javascript) 2 Answers
spawning script not working 0 Answers
Spawn Point Problems 1 Answer
How to turn on detectcollision on instantiated objects? 1 Answer