void Awake() { _ShadowDummyMesh = MeshGen.CreatePlane(new Vector3(0.0f, 0.0f, 1.0f), new Vector3(1.0f, 0.0f, 0.0f), _UVRect, new Color(_ShadowColor.r, _ShadowColor.g, _ShadowColor.b, _ShadowOpacity), this); Transform parent = transform; _ShadowDummy = new GameObject("shadowDummy").AddComponent <ProjectorShadowDummy>(); _ShadowDummy.transform.parent = parent; _ShadowDummy.transform.localPosition = new Vector3(0.0f, 0.0f, 0.0f); _ShadowDummy.transform.localRotation = Quaternion.identity * parent.localRotation; _ShadowDummy.gameObject.layer = LayerMask.NameToLayer(GlobalProjectorManager.GlobalProjectorLayer); _ShadowDummy._ShadowLocalOffset = _ShadowLocalOffset; _ShadowDummy._RotationAngleOffset = _RotationAngleOffset; _ShadowDummy._freezeXRot = _FreezeXRot; _ShadowDummy._freezeYRot = _FreezeYRot; _ShadowDummy._freezeZRot = _FreezeZRot; OnShadowSizeChanged(); _Renderer = _ShadowDummy.gameObject.AddComponent <MeshRenderer>(); _Renderer.receiveShadows = false; #if UNITY_5_1 || UNITY_5_2 || UNITY_5_3 || UNITY_5_4 || UNITY_5_5 || UNITY_5_6 || UNITY_5_7 || UNITY_2017 || UNITY_2018 || UNITY_2019 || UNITY_2020 _Renderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; #else _Renderer.castShadows = false; #endif _Renderer.material = _Material; _Renderer.enabled = false; _MeshFilter = _ShadowDummy.gameObject.AddComponent <MeshFilter>(); _MeshFilter.mesh = _ShadowDummyMesh; _initialSize = _ShadowSize; _initialOpacity = _ShadowOpacity; _discarded = false; }
void RebuildMesh() { _ShadowDummyMesh = MeshGen.CreatePlane(new Vector3(0.0f, 0.0f, 1.0f), new Vector3(1.0f, 0.0f, 0.0f), _UVRect, new Color(_ShadowColor.r, _ShadowColor.g, _ShadowColor.b, _ShadowOpacity), this); _MeshFilter.mesh = _ShadowDummyMesh; }