protected bool CreateMaterialEffect(UEffectMaterialParam _param) { if (!m_dicShaderTable.ContainsKey(_param.MaterialType)) { Shader TypeShader = AssetBundleManager.GetShader(m_dicMaterialDataTable[_param.MaterialType].ShaderPath); if (TypeShader == null) { Trace.LogWarning("不能找到名为:" + m_dicMaterialDataTable[_param.MaterialType].ShaderPath + "的shader"); return(false); } m_dicShaderTable.Add(_param.MaterialType, TypeShader); } Material tmpMaterial; if (!_param.IsNewMaterial && m_dicMaterialsTable.ContainsKey(_param.MaterialType) && m_dicMaterialsTable[_param.MaterialType] != null && m_dicMaterialsTable[_param.MaterialType].Count > 0) { tmpMaterial = _param.ReturnEffectMaterial = m_dicMaterialsTable[_param.MaterialType][0]; if (_param.GraphicsTarget != null) { _param.GraphicsTarget.material = tmpMaterial; } return(true); } _param.ReturnEffectMaterial = tmpMaterial = new Material(m_dicShaderTable[_param.MaterialType]); //tmpMaterial.hideFlags = HideFlags.do; if (m_dicMaterialsTable.ContainsKey(_param.MaterialType)) { m_dicMaterialsTable[_param.MaterialType].Add(tmpMaterial); } else { m_dicMaterialsTable.Add(_param.MaterialType, new List <Material>() { tmpMaterial }); } if (_param.GraphicsTarget != null) { _param.GraphicsTarget.material = tmpMaterial; } return(true); }
protected bool DestroyMaterialEffect(UEffectMaterialParam _param) { _param.GraphicsTarget.material = _param.GraphicsTarget.defaultMaterial; return(false); }