using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;

namespace URP
{
    public class BaseShaderGUI : ShaderGUI
    {
        MaterialProperty mainTex = null;
        MaterialProperty bake_MainTex = null; //由于官方URP不支持shadowMask烘培，但shadowmask使用的主要贴图名称是 _MainTex,所有当赋值_BaeMap时，也给_MainTex赋值，shader中需要加入 [HideInInspector] _MainTex("BaseMap", 2D) = "white" {} 

        public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] properties)
        {
            base.OnGUI(materialEditor, properties);

            try
            {
                mainTex = FindProperty("_BaseMap", properties);
                bake_MainTex = FindProperty("_MainTex", properties);
            }
            catch (System.Exception ex)
            {
                mainTex = null;
                bake_MainTex = null;
            }

            if (mainTex != null && bake_MainTex != null)
            {
                bake_MainTex.textureValue = bake_MainTex.textureValue;
            }
        }
    }
}