Renderer (416234)

Hey all,

I have been trying to get photon setup and working but having some issues. I got the demo up and running without problems but now what I’m trying to do is take the line that does -

GameObject actorCube = GameObject.CreatePrimitive(PrimitiveType.Cylinder);

and change it to something like

GameObject actorCube = new GameObject(“MainPlayer”);

MainPlayer is just a sphere with some scripts attached to it, it has a Sphere Mesh Filter, Sphere Collider, Mesh Renderer, and Character Controller.

The problem is I am getting this error every time I run it -

MissingComponentException: There is no ‘Renderer’ attached to the “MainPlayer” game object, but a script is trying to access it.
You probably need to add a Renderer to the game object “MainPlayer”. Or your script needs to check if the component is attached before using it.

Referencing this piece of code -

private bool ShowActor(bool show)
	{
		if (transform.renderer.enabled != show)
		{
			transform.renderer.enabled = show;
			this.actorText.transform.renderer.enabled = show;
			return true;
		}
		
		return false;
	}

Anyone else run into this? My assumption is because I am a newbie im doing something very simple wrong. The only component I can find with “Renderer” in it is the mesh component and its already added.

Thanks for any help in advance.[/code]

Ok well figured out that when it creates a new version of the prefab its not including anything along with it so thats obviously where my problem lays. Once I figure that out I should be golden.

If you are editing your prefab in the editor window, when you are finished are you using (from the Unity Menu bar) GameObject->Apply Changes to Prefab?