Пример #1
0
        void RefreshShaderGraphObject()
        {
            if (shaderGraph == null && !object.ReferenceEquals(shaderGraph, null))
            {
                string assetPath = AssetDatabase.GetAssetPath(shaderGraph.GetInstanceID());

                var newShaderGraph = AssetDatabase.LoadAssetAtPath <ShaderGraphVfxAsset>(assetPath);
                if (newShaderGraph != null)
                {
                    shaderGraph = newShaderGraph;
                }
            }
        }
Пример #2
0
        public ShaderGraphVfxAsset GetOrRefreshShaderGraphObject()
        {
            //This is the only place where shaderGraph property is updated or read
            if (shaderGraph == null && !object.ReferenceEquals(shaderGraph, null))
            {
                string assetPath = AssetDatabase.GetAssetPath(shaderGraph.GetInstanceID());

                var newShaderGraph = AssetDatabase.LoadAssetAtPath <ShaderGraphVfxAsset>(assetPath);
                if (newShaderGraph != null)
                {
                    shaderGraph = newShaderGraph;
                }
            }
            return(shaderGraph);
        }
Пример #3
0
 public ShaderGraphVfxAsset GetOrRefreshShaderGraphObject()
 {
     //This is the only place where shaderGraph property is updated or read
     if (shaderGraph == null)
     {
         if (!object.ReferenceEquals(shaderGraph, null)) //Invalid reference object, force reimport.
         {
             string assetPath      = AssetDatabase.GetAssetPath(shaderGraph.GetInstanceID());
             var    newShaderGraph = AssetDatabase.LoadAssetAtPath <ShaderGraphVfxAsset>(assetPath);
             if (newShaderGraph != null)
             {
                 shaderGraph = newShaderGraph;
             }
         }
         else if (!string.IsNullOrEmpty(shadergraphGUID)) //shaderGraph really null, load from save guid.
         {
             shaderGraph = AssetDatabase.LoadAssetAtPath <ShaderGraphVfxAsset>(AssetDatabase.GUIDToAssetPath(shadergraphGUID));
         }
     }
     return(shaderGraph);
 }