Search Unity

There is no 'Renderer' attached to the 'Main Camera' game object?

Discussion in 'Scripting' started by eric56379, Oct 30, 2014.

  1. eric56379

    eric56379

    Joined:
    Mar 11, 2014
    Posts:
    89
    Hi, so I have this script I am trying to use...
    Code (JavaScript):
    1. function Start () {
    2.  
    3. renderer.material.mainTexture.Play(); Invoke("nextScene", 15);
    4.  
    5. }
    6.  
    7. function nextScene ()
    8.  
    9. {
    10.  
    11. Application.LoadLevel("Menu");
    12.  
    13. }
    ...and keep getting this error that says "There is no 'Renderer' attached to the 'Main Camera' game object". Do you know how I can fix this? Thanks.
     
  2. Ian094

    Ian094

    Joined:
    Jun 20, 2013
    Posts:
    1,548
    Add a Renderer component to your main camera.
     
  3. eric56379

    eric56379

    Joined:
    Mar 11, 2014
    Posts:
    89
    Already contains the same component.
     
  4. hpjohn

    hpjohn

    Joined:
    Aug 14, 2012
    Posts:
    2,190
    Show us
     
  5. SteveJ

    SteveJ

    Joined:
    Mar 26, 2010
    Posts:
    3,085
    Why would you have/want to have a renderer on your camera?

    Sounds like you've got the script attached to the wrong object.
     
  6. unewbie

    unewbie

    Joined:
    Mar 29, 2014
    Posts:
    1
    That was my issue. Script should not have been attached to camera.