Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

camera.layerCullDistances question

Discussion in 'Scripting' started by angel_m, Oct 2, 2013.

  1. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Is it possible to use "camera.layerCullDistances" with different layers with the same camera in the same scene?
    I have tried it based in the Unity docs:

    Code (csharp):
    1.     function Start () {
    2.         var distances = new float[32];
    3.                 distances[10] = 15;
    4.         camera.layerCullDistances = distances;
    5.                 var moredistances = new float[32];
    6.                 moredistances[12] = 100;
    7.         camera.layerCullDistances = moredistances;
    8.     }
    9.  
    But, in this example, the camera only culls the last layer (layer number 12 defined in moredistances)


    Any idea?
     
  2. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    Any suggestion?
     
  3. Unity Ninja

    Unity Ninja

    Joined:
    Jun 14, 2014
    Posts:
    14
    Man I'm also confused about the
    camera.layerCullDistances
    What does "distances[10] = 15;" even mean?
     
  4. angel_m

    angel_m

    Joined:
    Nov 4, 2005
    Posts:
    1,160
    distances[10] = 15
    It means you set the distance for the objects in the layer number 10 to be "seen" by the camera at the distance of 15 units.
     
  5. DrakharStudio

    DrakharStudio

    Joined:
    Mar 2, 2012
    Posts:
    8
    The following should work:

    Code (csharp):
    1.     function Start () {
    2.         var distances = new float[32];
    3.                 distances[10] = 15;
    4.                 distances[12] = 100;
    5.         camera.layerCullDistances = distances;
    6.     }
    7.