Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


HasTexture

Checks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use MaterialPropertyBlock.SetTexture.
Read time 1 minuteLast updated 4 days ago

Definition

  • Type: Method
  • Namespace: UnityEngine
  • Assembly: UnityEngine.CoreModule

HasTexture(string)

Checks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use MaterialPropertyBlock.SetTexture.
public bool HasTexture(string name)

Parameters

name

The name of the property.

Returns

Type

Description

boolReturns true if MaterialPropertyBlock has this property.

Remarks

HasTexture(int)

Checks if MaterialPropertyBlock has the Texture property with the given name or name ID. To set the property, use MaterialPropertyBlock.SetTexture.
public bool HasTexture(int nameID)

Parameters

nameID

The name ID of the property. Use Shader.PropertyToID to get this ID.

Returns

Type

Description

boolReturns true if MaterialPropertyBlock has this property.

Remarks