/// <summary>
        /// This function is called when the behaviour becomes disabled () or inactive.
        /// </summary>
        protected override void OnDisable()
        {
            SetVerticesDirty();
            SetMaterialDirty();

            if (paramTex != null)
            {
                paramTex.Unregister(this);
            }

            MaterialCache.Unregister(_effectMaterialHash);
            _effectMaterialHash = k_InvalidHash;
        }
Exemplo n.º 2
0
        public virtual Material GetModifiedMaterial(Material baseMaterial, Graphic graphic)
        {
            if (!isActiveAndEnabled)
            {
                return(baseMaterial);
            }

            var oldHash = _effectMaterialHash;

            _effectMaterialHash = GetMaterialHash(baseMaterial);
            var modifiedMaterial = baseMaterial;

            if (_effectMaterialHash.isValid)
            {
                modifiedMaterial = MaterialCache.Register(baseMaterial, _effectMaterialHash, ModifyMaterial, graphic);
            }

            MaterialCache.Unregister(oldHash);

            return(modifiedMaterial);
        }