UnityEngine.Material.GetVector C# (CSharp) Method

GetVector() public method

Get a named vector value.

public GetVector ( int nameID ) : Vector4
nameID int The name ID of the property retrieved by Shader.PropertyToID.
return Vector4
        public Vector4 GetVector(int nameID)
        {
            Color color = this.GetColor(nameID);
            return new Vector4(color.r, color.g, color.b, color.a);
        }

Same methods

Material::GetVector ( string propertyName ) : Vector4

Usage Example

コード例 #1
0
        protected override void Init()
        {
            if (null == m_target)
            {
                return;
            }
            // end if
            var renderer = m_target.GetComponent <Renderer>();

            if (null != renderer)
            {
                m_Material = renderer.material;
            }
            // end if
            if (null == m_Material)
            {
                return;
            }
            // end if
            if (!string.IsNullOrEmpty(m_property))
            {
                m_beginVector = m_Material.GetVector(m_property);
            }
            else if (-1 != m_propertyID)
            {
                m_beginVector = m_Material.GetVector(m_propertyID);
            } // end if
        }
All Usage Examples Of UnityEngine.Material::GetVector