private void SetupSkySphere()
        {
#if UNITY_EDITOR
            Camera = (Camera == null ? (Camera.main == null ? Camera.current : Camera.main) : Camera);

            if (Resolution != lastResolution)
            {
                lastResolution = Resolution;
                DestroyMesh();
            }
            if (UVMode != lastUVMode)
            {
                lastUVMode = UVMode;
                DestroyMesh();
            }
            Mesh mesh = meshFilter.sharedMesh;
            if (mesh == null)
            {
                meshFilter.sharedMesh = WeatherMakerSphereCreator.Create(Resolution, UVMode);
            }
#endif

            float farPlane = FarClipPlaneMultiplier * Camera.farClipPlane;
            float yOffset  = farPlane * YOffsetMultiplier;
            gameObject.transform.position = Camera.transform.position + new Vector3(0.0f, yOffset, 0.0f);
            float scale = farPlane * ((Camera.farClipPlane - Mathf.Abs(yOffset)) / Camera.farClipPlane);
            gameObject.transform.localScale = new Vector3(scale, scale, scale);
        }
Ejemplo n.º 2
0
        protected virtual void Update()
        {
#if UNITY_EDITOR
            if (Resolution != lastResolution)
            {
                lastResolution = Resolution;
                DestroyMesh();
            }
            if (UVMode != lastUVMode)
            {
                lastUVMode = UVMode;
                DestroyMesh();
            }
            Mesh mesh = MeshFilter.sharedMesh;
            if (mesh == null)
            {
                MeshFilter.sharedMesh = WeatherMakerSphereCreator.Create(gameObject.name, Resolution, UVMode);
            }
#endif
        }