In the middle of the lecture after we create positions when i run the game Unity crashes without any error.
When i made the adjustments given later in the lecture to the EnemySpawner script it works ok,
GameObject enemy = Instantiate(enemyPrefab, child.transform.position, Quaternion.identity) as GameObject;
enemy.transform.parent = child;
the first solution;
GameObject enemy = Instantiate(enemyPrefab,new Vector3(0,0,0) ,Quaternion.identity) as GameObject;
causes an infinite loop and the editor crashes.
Hi,
I had this problem as well, I found the problem was relating to the line after the one you are listing
enemy.transform.parent=transform; = Compiler crash had to use task manager to end task
When using the line: enemy.transform.parent=child; . works fine
its annoying as I like to expirment with code but am not willing to after the crash - luckily I have a backup
Be interestd to know what the trainers think…
hey same thing happened to me, but does anybody know how the infinite loop is created?
I had the same problem! Apparentely, I was coding wrong, here is my mistake: enemy.transform.parent = child;
I was using “transform” instead of “child”. So I had an infinite loop which consumed all my memory.
exactly my problem as well!
Just chiming in to say I had the same issue.
Actually had the idea to use GetComponentsInChildren() to get my positions and iterate over those while having the video on the side and the iteration over the transforms came up. Didn’t make too much sense to me so I really wanted to test that out myself which of course led to Unity completely crashing.
I’m a bit disappointed that there still isn’t any disclaimer added into the lecture at this point tbh.
nice solution
nick de iyiymiĹź
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.