From 2d1dcc9d56eb274f75549b7d45465e74529450c5 Mon Sep 17 00:00:00 2001 From: Jussi Knuuttila Date: Thu, 13 Aug 2020 13:40:29 +0300 Subject: [PATCH] Uncomment adding backslashes to HYBRID_V1_CUSTOM_ADDITIONAL_MATERIAL_VARS generation, to fix Hybrid V1 not working with multiple properties. --- .../Editor/Generation/Processors/PropertyCollector.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs b/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs index af91b6d43d0..480b05d440a 100644 --- a/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs +++ b/com.unity.shadergraph/Editor/Generation/Processors/PropertyCollector.cs @@ -179,13 +179,16 @@ public string GetDotsInstancingPropertiesDeclaration(GenerationMode mode) builder.Append("#define HYBRID_V1_CUSTOM_ADDITIONAL_MATERIAL_VARS\t"); int count = 0; + int instancedCount = dotsInstancingProperties.Count(); foreach (var prop in dotsInstancingProperties) { string varName = $"{prop.referenceName}_Array"; string sType = prop.concreteShaderValueType.ToShaderString(prop.concretePrecision); builder.Append("UNITY_DEFINE_INSTANCED_PROP({0}, {1})", sType, varName); -// if (count < instancedCount - 1) -// builder.Append("\\"); + // Combine the UNITY_DEFINE_INSTANCED_PROP lines with \ so the generated + // macro expands into multiple definitions if there are more than one. + if (count < instancedCount - 1) + builder.Append("\\"); builder.AppendLine(""); count++; }