public void OnDisable() { Texture2D curTex = Texture; Material = BlendMaterials.GetMaterial(ObjectType, RenderMode.Grab, BlendMode.Normal); if (Material && curTex) { Material.mainTexture = curTex; } }
/// <summary> /// Sets specific blend mode to the object. /// </summary> /// <param name="blendMode">Blend mode.</param> /// <param name="renderMode">Render mode to use for blending.</param> public void SetBlendMode(BlendMode blendMode, RenderMode renderMode = RenderMode.Grab) { if (ObjectType == ObjectType.Unknown) { return; } Material = BlendMaterials.GetMaterial(ObjectType, renderMode, blendMode); Texture = Texture; TintColor = TintColor; _blendMode = blendMode; _renderMode = renderMode; }
public void SetBlendMode(BlendMode blendMode) { if (blendMode == BlendMode.Normal) { OverlayMaterial.SetFloat("_IsNormalBlendMode", 1); } else { OverlayMaterial = BlendMaterials.GetMaterial(ObjectType.ScreenOverlay, blendMode: blendMode, shader: OverlayShader); OverlayMaterial.SetFloat("_IsNormalBlendMode", 0); } _blendMode = blendMode; _overlayTexture = OverlayTexture; _tintColor = TintColor; }
/// <summary> /// Sets specific blend mode to the object. /// </summary> /// <param name="blendMode">Blend mode.</param> /// <param name="renderMode">Render mode to use for blending.</param> public void SetBlendMode(BlendMode blendMode, RenderMode renderMode = RenderMode.Grab) { _blendMode = blendMode; _renderMode = renderMode; if (ObjectType == ObjectType.Unknown) { return; } Material = BlendMaterials.GetMaterial(ObjectType, renderMode, blendMode); SetupTexture(); SetupTintColor(); SetupStencil(); }
/// <summary> /// Sets specific blend mode to the object. /// </summary> /// <param name="blendMode">Blend mode.</param> /// <param name="renderMode">Render mode to use for blending.</param> /// <param name="selectiveBlending">While selective blending is active the object will use custom blending only with other objects in this mode and keep normal blend mode with everything else.</param> public void SetBlendMode(BlendMode blendMode, RenderMode renderMode = RenderMode.Grab, bool selectiveBlending = false) { if (ObjectType == ObjectType.Unknown) { return; } if (renderMode == RenderMode.UnifiedGrab) { selectiveBlending = false; } Material = BlendMaterials.GetMaterial(ObjectType, renderMode, blendMode, selectiveBlending); Texture = Texture; TintColor = TintColor; _blendMode = blendMode; _renderMode = renderMode; _selectiveBlending = selectiveBlending; }