diff --git a/Editor/Generation/ShaderBuilder.cs b/Editor/Generation/ShaderBuilder.cs index 7415303..186d431 100644 --- a/Editor/Generation/ShaderBuilder.cs +++ b/Editor/Generation/ShaderBuilder.cs @@ -388,12 +388,17 @@ private void AppendProperties() { var allProperties = passBuilders.SelectMany(x => x.properties).ToList(); + var addedProps = new List(); + if (unlocked) { foreach (var property in properties.Union(ShaderGraphView.graphData.properties).Union(subgraphProperties).Distinct()) { if (property.ShouldDeclare()) + { _sb.AppendLine(property.GetPropertyDeclaration(GenerationMode.Final)); + addedProps.Add(property.GetReferenceName(GenerationMode.Final)); + } } } @@ -403,8 +408,15 @@ private void AppendProperties() { continue; } + if (unlocked && addedProps.Contains(property.GetReferenceName(GenerationMode.Preview))) + { + continue; + } if (property.ShouldDeclare()) + { _sb.AppendLine(property.GetPropertyDeclaration(GenerationMode.Preview)); + addedProps.Add(property.GetReferenceName(GenerationMode.Preview)); + } } } else