When trying to do the Space-Shooter tutorial, several issues were raised. Some of them are listed here with their solutions:
- The asteroid is not rotating with the rotator script
- The boundary is not working properly.
- In order to fire bolts, I am told to write Input.GetButton("Fire1").
- I already did the space ship, background and lights in the tutorial. I made the script to move the space ship as I was told, but decided to test this script. My spaceship moved, but it returns to its original position and cannot move after a certain distance.
- UnassignedReferenceException: The variable scoreText of GameController has not been assigned. You probably need to assign the scoreText variable of the GameController script in the inspector.
- Game Object deleted from scene but not from the hierarchy.
- "The content was stopped because a fatal content error has been detected" when building the Webplayer.
- Unity keeps freezing everytime I enter playmode.
- Didn't take to account Unity is case sensitive when scripting and wrote an Unity API function without capital letter or had a typo, missed a semicolon etc. (e.g wrote the start function with 's' while is Start with capital 'S' or wrote onTriggerExit with no capital 'o')
- The boundary box is not high enough; bolts didn't start inside the box.
- You do not know where or what is "Fire1".
- You did not remember to change the boundary values.
- You are using a legacy component like GUIText.
- Not deleting the object with Destroy or there is a collider added wrong (collider in the child instead of the parent)
- In the Graphic section of the Project Settings, you only have one shader (Diffuse) while you need to have as well 'UI/Default' and 'UI/Default Font'.
- There is an infinite loop occurring.
- Fix the case sensitive problem or typo. (e.g write the Start function with capital 'S' , OnTriggerExit with capital 'O')
- Scale the box in the direction it needs to be scale (e.g 'Y' direction) to correct the error.
- "Fire1" is a preset configuration set in Unity to reference some buttons that are used to fire shots. In other words, this string is mapped to some buttons already by Unity by default. To check this, please go do Edit->Project Settings ->Input to check the different preset configurations regarding Input.
- Reset the boundary in the inspector.
- Change the attribute declaration from GUIText scoreText, to Text scoreText. Add in the Start function a line of code to reference this text element: scoreText = GetComponent<Text>(). If later you get an error that states that the text is not set to an object then just remove this last line in the Start function.
- Move the collider from the child object to the parent.
- Go to Edit -> Project Settings -> Graphics and add the 'UI/Default' and 'UI/Default Font' shaders manually or just click in the gear icon and "reset" to also add these shaders.
- Find the While (true) loop, or any other loop that can be iterating infinitely and fix it.
See the links below:
This article applies to Unity versions 5.x