1234567891011121314151617181920212223242526 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class IgnoreClipping : MonoBehaviour
- {
- public int ignoreClippingLayer = 13;
- public float preClippingDistance = 1000f;
- public int smallObjectsLayer = 14;
- public float smallObjectsDistance = 200f;
-
- void Start()
- {
- var cam = GetComponent<Camera>();
- var distances = new float[32];
- for (int i = 0; i < distances.Length; i++)
- {
- distances[i] = preClippingDistance;
- }
- distances[ignoreClippingLayer] = 0f;
- distances[smallObjectsLayer] = smallObjectsDistance;
- cam.layerCullDistances = distances;
- }
- }
|