`urp-postprocessing`: Global Volume template's `profile.Add<T>()` overrides are lost after Editor restart (never added as sub-assets)

Abierto
#104 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
72/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp, unity

Línea de trabajo

Read skills/urp-postprocessing/references/code-templates.md at “Creating a Global Volume with Effects” and the cited sections of skills/urp-postprocessing/SKILL.md. Check how the template adds components and how the skill describes persistence and diagnostics. Update the guidance and template to account for Editor asset persistence; done when newly added overrides survive an asset reload and the documented checks identify missing sub-assets.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Plugin: 0.1.8-beta (main @ 3831ddb) · Unity: 6000.6.7f1 · URP / SRP Core: 17.6.0

Problem

skills/urp-postprocessing/references/code-templates.md, "Creating a Global Volume with Effects" (L19–43):

  1. AssetDatabase.CreateAsset(profile, …)
  2. profile.Add<Bloom>() / profile.Add<Tonemapping>()
  3. SetDirty(profile) + AssetDatabase.SaveAssets()

The added VolumeComponents are never stored as sub-assets of the profile. Everything looks right for the rest of the session, but after an Editor restart (or any reload of the asset) the profile has no overrides. We hit exactly this: a color-grading profile built this way came back empty after restarting the Editor.

SKILL.md L111, L141, L148, L156 present profile.Add<T>() as the way to add overrides, with no Editor-persistence caveat.

Why

  • VolumeProfile.Add(Type, bool) (com.unity.render-pipelines.core/Runtime/Volume/VolumeProfile.cs L109–123) only does CreateInstance(type) + components.Add(component) — no AssetDatabase.AddObjectToAsset, so the component lives in memory only and the reference does not survive serialization. On the next load VolumeProfile.OnEnable runs components.RemoveAll(x => x == null).
  • Unity's own Editor code always pairs Add with AddObjectToAsset: Editor/Volume/VolumeComponentListEditor.cs (inspector "Add Override", L518: AssetDatabase.AddObjectToAsset(component, asset)), Editor/Volume/VolumeProfileFactory.cs (VolumeProfileFactory.CreateVolumeComponent<T>, L109), Editor/Volume/VolumeProfileUtils.cs.

The skill's own checks don't catch it

  • SKILL.md L87–91 only warns when profile.components.Count == 0; in the same session the list still holds the in-memory instances, so it reports the setup as correct.
  • code-templates.md L123–125 says SaveAssets() persists the profile — true for editing existing overrides, not for newly added ones.

Suggested fix

  • In the template, after each Add<T>(): UnityEditor.AssetDatabase.AddObjectToAsset(bloom, profile); — or use UnityEditor.Rendering.VolumeProfileFactory.CreateVolumeComponent<T>(profile, overrides: true, saveAsset: false), then SaveAssets() once.
  • Key Facts: "On a profile asset in the Editor, Add<T>() alone is in-memory only; also call AssetDatabase.AddObjectToAsset. A runtime volume.profile instance doesn't need it."
  • Diagnostic: also warn when EditorUtility.IsPersistent(profile) and any component has !AssetDatabase.IsSubAsset(c).
Lenguaje dominante
C#
Estrellas
590
Forks
67
Merge medio
3 d 4 h
PR fusionados (30 d)
13

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Unity-Technologies/unity-agent-plugin

Todos los issues de Unity-Technologies/unity-agent-plugin

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.