What is causing my Spawner script to break Unity?
I believe it’s a combination of my player movement script which gives me an error code - Look rotation viewing vector is zero UnityEngine.Quaternion:LookRotation(Vector3), my camera script and my spawner script. When my camera and player movement script run separately and together I just receive the error code, it still plays. Once the spawner script is added it breaks unity. I’ve went line by line adding a new line after each play button press, to see when it breaks and it seems to start with the SpawnRandom method. What am I not seeing? What am I doing wrong? Thank you for all your help. It is much appreciated. each script is using: using System.Collections; using System.Collections.Generic; MonoBehaviour
alt text
Answer by OneCept-Games · Jan 02, 2018 at 02:47 PM
You never end your SpawnRandom() function, that will cause Unity to time out.
I Don't fully understand what you mean, I never end the function? Do I create another method? Or would that be within the spawnRandom method add an else statement stop spawning? Or add an while (false) stop spawning? I thought it stopped when the timer/counter reset to = 0. Every time it "Instantiate" a random block the timer reset?
Your while(true) {} has no "break", but I cannot see what comes after the if in you code, since according to your screenshot the } for the while and the method is missing... Paste more code, and I might be able to help more.
Thank you for you help. I actually decided to go a different route that would help reduce lines of code and other eventual methods. I don't know about saving performance issues but this is an workable alternative to the same feature I want in my game. This script does not have a counter, but triggers. Player out of trigger area = will not spawn a random colored block. Player in trigger area will spawn a random colored block.
Your answer
Follow this Question
Related Questions
plsss do help to select a spawnpoint from 3spawnpoints 1 Answer
Instantiate() Argument error 1 Answer
Instantiate Object using Vector3 at posision? 1 Answer
Cant Get a Bullet to Shoot (C#) 2 Answers