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:

Either have it find Sphere in order to change the color, add a Renderer component, or comment this line out since we are not changing the color of the enemy anymore.

Advertisements

1 Comment

  1. August 16, 2011 at 8:42 am

    Wonderful, keep it up thanks.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: