From 978284db7aaf2723fcd3e3720c583a8f4d7d3527 Mon Sep 17 00:00:00 2001 From: z3y Date: Thu, 31 Oct 2024 11:20:52 +0100 Subject: [PATCH] fix gpu instanced properties --- Docs~/pages/live-preview.mdx | 2 +- Editor/Targets/Vertex.hlsl | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Docs~/pages/live-preview.mdx b/Docs~/pages/live-preview.mdx index 9865c97..36eb472 100644 --- a/Docs~/pages/live-preview.mdx +++ b/Docs~/pages/live-preview.mdx @@ -3,7 +3,7 @@ import Image from "next/image" # Live Preview Live Preview updates all constant properties like Color, Float while working on the shader for preview in the scene view. -It does not work with other materials. +It only works with the imported material subasset. This is similar to shader locking or baking which optimizes the shader by reducing the need for material properties. ![Image](/generated-material.png) diff --git a/Editor/Targets/Vertex.hlsl b/Editor/Targets/Vertex.hlsl index 2d4f456..905464f 100644 --- a/Editor/Targets/Vertex.hlsl +++ b/Editor/Targets/Vertex.hlsl @@ -3,10 +3,12 @@ Varyings vert(Attributes input) { Varyings varyings = (Varyings)0; + UNITY_INITIALIZE_OUTPUT(Varyings, varyings); + #if !defined(UNITY_PASS_META) UNITY_SETUP_INSTANCE_ID(input); + UNITY_TRANSFER_INSTANCE_ID(input, varyings); #endif - UNITY_INITIALIZE_OUTPUT(Varyings, varyings); UNITY_INITIALIZE_VERTEX_OUTPUT_STEREO(varyings); VertexDescription vertexDescription = VertexDescriptionFunction(input, varyings);