コード例 #1
0
 void Update()
 {
     if (_overrides == null)
     {
         _overrides = new MaterialPropertyBlock();
     }
     _overrides.SetLinearGradient("_Gradient1", _gradient);
     GetComponent <Renderer>().SetPropertyBlock(_overrides);
 }
コード例 #2
0
        MaterialPropertyBlock UpdatePropertyBlock()
        {
            if (_props == null)
            {
                _props = new MaterialPropertyBlock();
            }

            var fillParams = new Vector3(_backOpacity, _frontOpacity, _dithering);
            var lineParams = new Vector2(_lineThreshold, _lineContrast);

            _props.SetLinearGradient("_BackGradient", _backGradient);
            _props.SetLinearGradient("_FrontGradient", _frontGradient);
            _props.SetVector("_FillParams", fillParams);

            _props.SetColor("_LineColor", _lineColor);
            _props.SetVector("_LineParams", lineParams);

            return(_props);
        }