static T LoadResourceFile <T>() where T : ScriptableObject
        {
            T   resourceAsset = null;
            var guids         = AssetDatabase.FindAssets(typeof(T).Name + " t:scriptableobject", new[] { "Assets" });

            foreach (string guid in guids)
            {
                string path = AssetDatabase.GUIDToAssetPath(guid);
                resourceAsset = AssetDatabase.LoadAssetAtPath <T>(path);
                if (resourceAsset != null)
                {
                    break;
                }
            }

            // There's currently an issue that prevents FindAssets from find resources withing the package folder.
            if (resourceAsset == null)
            {
                string path = packagePath + "/Runtime/Data/" + typeof(T).Name + ".asset";
                resourceAsset = AssetDatabase.LoadAssetAtPath <T>(path);
            }

            // Validate the resource file
            ResourceReloader.TryReloadAllNullIn(resourceAsset, packagePath);

            return(resourceAsset);
        }
Exemplo n.º 2
0
            public override void Action(int instanceId, string pathName, string resourceFile)
            {
                var instance = CreateInstance <GraphicProfile>();

                ResourceReloader.TryReloadAllNullIn(instance, packagePath);
                AssetDatabase.CreateAsset(instance, pathName);
            }
Exemplo n.º 3
0
        protected override void OnEnable()
        {
            base.OnEnable();

            // Provide a list of suggested texture property names to Sprite Editor via EditorPrefs.
            const string suggestedNamesKey   = "SecondarySpriteTexturePropertyNames";
            const string maskTex             = "_MaskTex";
            const string normalMap           = "_NormalMap";
            string       suggestedNamesPrefs = EditorPrefs.GetString(suggestedNamesKey);

            if (string.IsNullOrEmpty(suggestedNamesPrefs))
            {
                EditorPrefs.SetString(suggestedNamesKey, maskTex + "," + normalMap);
            }
            else
            {
                if (!suggestedNamesPrefs.Contains(maskTex))
                {
                    suggestedNamesPrefs += ("," + maskTex);
                }

                if (!suggestedNamesPrefs.Contains(normalMap))
                {
                    suggestedNamesPrefs += ("," + normalMap);
                }

                EditorPrefs.SetString(suggestedNamesKey, suggestedNamesPrefs);
            }

            ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
            ResourceReloader.TryReloadAllNullIn(m_PostProcessData, UniversalRenderPipelineAsset.packagePath);
        }
Exemplo n.º 4
0
        public override void Create()
        {
#if UNITY_EDITOR
            ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
#endif
            m_DecalPreviewPass = new DecalPreviewPass();
            m_RecreateSystems  = true;
        }
Exemplo n.º 5
0
        private void ReloadAllNullProperties()
        {
            ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);

            // As now post process data is stored in Universal Render Pipeline, we can dereference non custom data.
            if (m_PostProcessData == PostProcessData.GetDefaultPostProcessData())
            {
                m_PostProcessData = null;
            }
        }
Exemplo n.º 6
0
        public void Setup(RenderTargetIdentifier source)
        {
#if UNITY_EDITOR
            if (Application.isPlaying)
            {
                ResourceReloader.TryReloadAllNullIn(this, "Packages/com.sbstn_hn.rendererfeatures.urp-ssao");
            }
#endif

            this.source = source;
        }
    protected override ScriptableRenderer Create()
    {
#if UNITY_EDITOR
        if (!Application.isPlaying)
        {
            ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
            ResourceReloader.TryReloadAllNullIn(postProcessData, UniversalRenderPipelineAsset.packagePath);
        }
#endif
        return(new CustomForwardRenderer(this));
    }
Exemplo n.º 8
0
    public override void Create()
    {
#if UNITY_EDITOR
        ResourceReloader.TryReloadAllNullIn(settings, "Assets/");
#endif
        m_ScriptablePassOpaque = new OnlyDepthShadowmapRenderPass("Render Custom Shadowmap", true, RenderPassEvent.BeforeRendering - 10, RenderQueueRange.opaque, settings.OpaqueLayerMask);

        m_ScriptablePassOpaque._ShadowParams   = settings.ShadowColor;
        m_ScriptablePassOpaque._ShadowParams.w = settings.ShadowBias;
        //m_ScriptablePassTransparent = new LayerRenderPass("Render Player Transparent", false, RenderPassEvent.AfterRenderingTransparents + 11, RenderQueueRange.transparent, settings.TransparentLayerMask);
    }
Exemplo n.º 9
0
        //[SerializeField] bool m_TiledDeferredShading = false;

        protected override ScriptableRenderer Create()
        {
#if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
                ResourceReloader.TryReloadAllNullIn(postProcessData, UniversalRenderPipelineAsset.packagePath);
#if ENABLE_VR && ENABLE_XR_MODULE
                ResourceReloader.TryReloadAllNullIn(xrSystemData, UniversalRenderPipelineAsset.packagePath);
#endif
            }
#endif
            return(new ToonForwardRenderer(this));
        }
Exemplo n.º 10
0
    public override void Create()
    {
#if UNITY_EDITOR
        ResourceReloader.TryReloadAllNullIn(settings, "Assets/");
#endif

        m_StencilPass        = new StencilRenderPass(settings);
        m_ReflectionsPass    = new ReflectionsRenderPass(settings);
        m_DrawReflectivePass = new DrawReflectiveLayerRenderPass(settings);

        // Configures where the render pass should be injected.
        m_StencilPass.renderPassEvent        = RenderPassEvent.BeforeRenderingOpaques;
        m_ReflectionsPass.renderPassEvent    = RenderPassEvent.AfterRenderingSkybox;
        m_DrawReflectivePass.renderPassEvent = RenderPassEvent.AfterRenderingSkybox;
    }
    protected override void OnEnable()
    {
        base.OnEnable();

        // Upon asset creation, OnEnable is called and `shaders` reference is not yet initialized
        // We need to call the OnEnable for data migration when updating from old versions of UniversalRP that
        // serialized resources in a different format. Early returning here when OnEnable is called
        // upon asset creation is fine because we guarantee new assets get created with all resources initialized.
        if (shaders == null)
        {
            return;
        }

#if UNITY_EDITOR
        ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
        ResourceReloader.TryReloadAllNullIn(postProcessData, UniversalRenderPipelineAsset.packagePath);
#endif
    }
Exemplo n.º 12
0
 private void ReloadAllNullProperties()
 {
     ResourceReloader.TryReloadAllNullIn(this, UniversalRenderPipelineAsset.packagePath);
 }