UnityEngine.Material.GetTextureOffset C# (CSharp) Method

GetTextureOffset() public method

Gets the placement offset of texture propertyName.

public GetTextureOffset ( string propertyName ) : Vector2
propertyName string The name of the property.
return Vector2
        public Vector2 GetTextureOffset(string propertyName)
        {
            Vector4 vector;
            Internal_GetTextureScaleAndOffset(this, propertyName, out vector);
            return new Vector2(vector.z, vector.w);
        }

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_beginOffset = m_Material.GetTextureOffset(m_property);
            }
            else if (-1 != m_propertyID)
            {
                m_beginOffset = m_Material.GetTextureOffset(m_propertyID);
            } // end if
        }
All Usage Examples Of UnityEngine.Material::GetTextureOffset