Programming Error: Unreachable Code Detected

Explanation:
This is generally when there is a fragment of code that can never be accessed under any circumstance. It’s a very general category. It might happen if you create an infinite loop that has code after it – since it’s infinite, it will never end to execute the next line. It can also happen if there is an impossible if/else, switch or other control structure. “Impossible” does not allow for any circumstance where it can happen. It is logically impossible.

Example:
while(true) {
Something();
}
OtherThing();

Solution:
Read the rest of this entry »

Advertisements

Unity Error: No 'Renderer' attached to game object.

MissingComponentException: There is no 'Renderer' attached to the "mob_Slug" game object, but a script is trying to access it.

You probably need to add a Renderer to the game object "mob_Slug". Or your script needs to check if the component is attached before using it.

From Tutorial 51: Targetting 2.0 part 1

Explanation:
mob_Slug1 has an animation and a mob, but not a Renderer. It’s looking for a renderer because we are changing the color, and in order to get that material you have to go to the subfolder in the mob called Sphere, which holds the texture.

Example:
selectedTarget.renderer.material.color = Color.magenta;

Solution:
Read the rest of this entry »