Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

GrassGeneratorquery

Discussion in 'Scripting' started by AaronC, Dec 9, 2006.

  1. AaronC

    AaronC

    Joined:
    Mar 6, 2006
    Posts:
    3,553
    Hey guys, and Becky.
    Hey so heres a bit from the grass generator script
    Code (csharp):
    1.     Vector3 direction = Camera.main.transform.TransformDirection(Vector3.forward);
    2.         Vector3 position = Camera.main.transform.position;
    Is it possible to have the generator work if using more than 1"Main Camera"?
    I have a car, you can switch views by toggling cameras, but i always get this error, and i fear it is stuffing up other stuff and stopping it from working. I tried swapping Main with cameracurrent and that didnt work. Should I just forget about the grass generator?
    Calling every camera Main Camera doesnt cut it either
    Thanks Yo
    AC
     

    Attached Files:

  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    You have to make the camera's tag be "MainCamera", otherwise the script cant find the camera. If you have two enabled cameras at a time you need to make sure only the one which you want the grass on has the MainCamera tag.