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