Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Layers

Discussion in 'Editor & General Support' started by Mike08, Apr 2, 2006.

  1. Mike08

    Mike08

    Joined:
    Dec 29, 2005
    Posts:
    124
    Hi

    can somebody tell me what layers are and how I can use them.

    I read in the forum about it and I read there that you can choose which object is rendered by which camera.

    How can I do this.
     
  2. Mike08

    Mike08

    Joined:
    Dec 29, 2005
    Posts:
    124
    Can somebody tell me how I can do this?

    What is the Tags Manager for.

    I need really help there.
     
  3. hsparra

    hsparra

    Joined:
    Jul 12, 2005
    Posts:
    750
    Here is how I have used layers so the camera only renders certain objects.

    1. Go to Edit --> Project Settings --> Tags (Note: you can get here also by selecting an object and on the Tag drop down or the Layer drop down, select "Add new tag" or "Add new layer" respectively.
    2. Next to one of the layers type in a name that identifies that layer. For example, I might use "Reflected" to use on objects that I am going to show a reflection of, of "HUD" for objects that I am going to use to create a HUD.
    3. Go to your camera and on the "Culling Mask" setting, select your named layer and unselect (so there is no check mark) the other layers.
    4. Go to the object you want rendered by that camera and select your named layer from the "Layer" dropdown.

    The camera should now just render those objects with your named layer.
     
  4. Sync1B

    Sync1B

    Joined:
    Sep 13, 2005
    Posts:
    561
    It always helps to see an example.

    I am using layers to render a 3D globe map in my HUD. All my objects in the game world will have a child that is a billboard icon that will only render in my "map layer". Then I have a camera rendering the globe graphics and object icons. It looks some thing like this. It's very unfinished but you get the idea.
     

    Attached Files:

  5. Mike08

    Mike08

    Joined:
    Dec 29, 2005
    Posts:
    124
    Thanks for your great help. It works now. (Now I can start to create a good FPS)

    But I have some questions.

    First: How can I make that a object is available in two layers (i.g. map and player)

    Second: How can I make that the mapcamera has got a transparent background (you can see the your picture of the playercamera or when you create a sphere like map because the viewport is a rect).
     
  6. antenna-tree

    antenna-tree

    Joined:
    Oct 30, 2005
    Posts:
    5,324
    This thread may help...

    http://forum.otee.dk/viewtopic.php?t=1486

    Basically you need to change the "clear flag" of your camera to either "depth only" or "don't clear" and make sure it renders second.

    For making cameras only render certain objects you need to play around with the "culling mask" settings of the 2 cameras. Put all objects NOT to be rendered by one camera into a layer, and then choose to cull that layer in the camera's settings.
     
  7. Mike08

    Mike08

    Joined:
    Dec 29, 2005
    Posts:
    124
    Thanks a lot for your great help.