|
|
|
|
|
|
m_Material = hdrp != null ? hdrp.GetDefaultDecalMaterial() : null; |
|
|
|
} |
|
|
|
|
|
|
|
DecalSystem.instance.AddDecal(this); |
|
|
|
} |
|
|
|
|
|
|
|
public void Start() |
|
|
|
{ |
|
|
|
DecalSystem.instance.AddDecal(this); |
|
|
|
if(m_Handle != null) |
|
|
|
DecalSystem.instance.RemoveDecal(m_Handle); |
|
|
|
m_Handle = DecalSystem.instance.AddDecal(transform, m_DrawDistance, m_FadeScale, m_Material); |
|
|
|
DecalSystem.instance.RemoveDecal(this); |
|
|
|
DecalSystem.instance.RemoveDecal(m_Handle); |
|
|
|
m_Handle = null; |
|
|
|
} |
|
|
|
|
|
|
|
// Declare the method signature of the delegate to call.
|
|
|
|
|
|
|
// handle material changes
|
|
|
|
if (m_OldMaterial != m_Material) |
|
|
|
{ |
|
|
|
Material tempMaterial = m_Material; |
|
|
|
m_Material = m_OldMaterial; |
|
|
|
if(m_Material != null) |
|
|
|
DecalSystem.instance.RemoveDecal(this); |
|
|
|
m_Material = tempMaterial; |
|
|
|
DecalSystem.instance.AddDecal(this); |
|
|
|
if( m_Handle != null) |
|
|
|
DecalSystem.instance.RemoveDecal(m_Handle); |
|
|
|
m_Handle = DecalSystem.instance.AddDecal(transform, m_DrawDistance, m_FadeScale, m_Material); |
|
|
|
m_OldMaterial = m_Material; |
|
|
|
|
|
|
|
// notify the editor that material has changed so it can update the shader foldout
|
|
|
|