From 11ab63660896bc78be168153502c68ab4ba2a170 Mon Sep 17 00:00:00 2001 From: Nikita Dugin Date: Tue, 7 Apr 2026 17:30:17 +0300 Subject: [PATCH] Fix missing shader in build --- Assets/Features/VoxelWorld/Prefabs.meta | 8 ++ .../VoxelWorld/Prefabs/VoxelWorld.prefab | 49 ++++++++ .../VoxelWorld/Prefabs/VoxelWorld.prefab.meta | 7 ++ .../VoxelWorld/Runtime/VoxelWorldAtlas.cs | 8 +- .../VoxelWorld/Runtime/VoxelWorldGenerator.cs | 3 +- .../Scenes/VoxelWorldTestScene.unity | 105 ++++++++++-------- 6 files changed, 130 insertions(+), 50 deletions(-) create mode 100644 Assets/Features/VoxelWorld/Prefabs.meta create mode 100644 Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab create mode 100644 Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab.meta diff --git a/Assets/Features/VoxelWorld/Prefabs.meta b/Assets/Features/VoxelWorld/Prefabs.meta new file mode 100644 index 00000000..421001a2 --- /dev/null +++ b/Assets/Features/VoxelWorld/Prefabs.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 67e1b040a2dcc344dbf491999c0877ba +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab b/Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab new file mode 100644 index 00000000..f9bd641e --- /dev/null +++ b/Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab @@ -0,0 +1,49 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &797018065588400165 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 74135865886311664} + - component: {fileID: 2927522923773808063} + m_Layer: 0 + m_Name: VoxelWorld + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &74135865886311664 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797018065588400165} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2927522923773808063 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 797018065588400165} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 62cd563780165844caddc098f92ff23f, type: 3} + m_Name: + m_EditorClassIdentifier: VoxelWorld.Runtime::InfiniteWorld.VoxelWorld.VoxelWorldGenerator + streamTarget: {fileID: 0} + config: {fileID: 11400000, guid: b8cf28a5522134b479c23f017234070c, type: 2} + _terrainShader: {fileID: 4800000, guid: ec80aebd8cb61f44cbfa6b7d5f087211, type: 3} diff --git a/Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab.meta b/Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab.meta new file mode 100644 index 00000000..6c1042ed --- /dev/null +++ b/Assets/Features/VoxelWorld/Prefabs/VoxelWorld.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 91b5caa5457131b4f8c542529f4ad7c3 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Features/VoxelWorld/Runtime/VoxelWorldAtlas.cs b/Assets/Features/VoxelWorld/Runtime/VoxelWorldAtlas.cs index ed24f97f..1c00ae72 100644 --- a/Assets/Features/VoxelWorld/Runtime/VoxelWorldAtlas.cs +++ b/Assets/Features/VoxelWorld/Runtime/VoxelWorldAtlas.cs @@ -41,7 +41,7 @@ namespace InfiniteWorld.VoxelWorld internal sealed class VoxelWorldAtlas : IDisposable { private const int FallbackTileSize = 32; - private const string ShaderName = "Infinite World/VoxelWorld/TextureArrayUnlit"; + // private const string ShaderName = "Infinite World/VoxelWorld/TextureArrayUnlit"; private static readonly VoxelSurfaceType[] SurfaceOrder = { @@ -76,7 +76,7 @@ namespace InfiniteWorld.VoxelWorld return layerLookup[0][surfaceType]; } - public static VoxelWorldAtlas CreateRuntimeAtlas(IReadOnlyList biomeProfiles) + public static VoxelWorldAtlas CreateRuntimeAtlas(IReadOnlyList biomeProfiles, Shader terrainShader) { List sourceBiomes = new List(); if (biomeProfiles != null) @@ -134,11 +134,11 @@ namespace InfiniteWorld.VoxelWorld textureArray.Apply(false, false); - Shader shader = Shader.Find(ShaderName); + Shader shader = terrainShader; if (shader == null) { shader = Shader.Find("Universal Render Pipeline/Unlit") ?? Shader.Find("Standard"); - Debug.LogError($"Shader '{ShaderName}' was not found. Falling back to '{shader?.name ?? ""}', but voxel texture array sampling will not work until the shader asset is imported correctly."); + Debug.LogError($"Shader was not found. Falling back to '{shader?.name ?? ""}', but voxel texture array sampling will not work until the shader asset is imported correctly."); } Material material = new Material(shader) diff --git a/Assets/Features/VoxelWorld/Runtime/VoxelWorldGenerator.cs b/Assets/Features/VoxelWorld/Runtime/VoxelWorldGenerator.cs index d3c37bae..fb0e468c 100644 --- a/Assets/Features/VoxelWorld/Runtime/VoxelWorldGenerator.cs +++ b/Assets/Features/VoxelWorld/Runtime/VoxelWorldGenerator.cs @@ -10,6 +10,7 @@ namespace InfiniteWorld.VoxelWorld [Header("References")] [SerializeField] private Transform streamTarget; [SerializeField] private VoxelWorldConfig config; + [SerializeField] private Shader _terrainShader; private readonly Dictionary chunks = new Dictionary(); private readonly Dictionary regions = new Dictionary(); @@ -134,7 +135,7 @@ namespace InfiniteWorld.VoxelWorld } atlas?.Dispose(); - atlas = VoxelWorldAtlas.CreateRuntimeAtlas(biomeProfiles); + atlas = VoxelWorldAtlas.CreateRuntimeAtlas(biomeProfiles, _terrainShader); atlasBiomeCount = atlas.BiomeCount; RefreshRegionMaterials(); } diff --git a/Assets/Features/VoxelWorld/Scenes/VoxelWorldTestScene.unity b/Assets/Features/VoxelWorld/Scenes/VoxelWorldTestScene.unity index 1d2b6978..38d3bbbd 100644 --- a/Assets/Features/VoxelWorld/Scenes/VoxelWorldTestScene.unity +++ b/Assets/Features/VoxelWorld/Scenes/VoxelWorldTestScene.unity @@ -383,56 +383,71 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &1842209026 -GameObject: +--- !u!1001 &6493552143235564167 +PrefabInstance: m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1842209028} - - component: {fileID: 1842209027} - m_Layer: 0 - m_Name: VoxelWorld - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &1842209027 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1842209026} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 62cd563780165844caddc098f92ff23f, type: 3} - m_Name: - m_EditorClassIdentifier: VoxelWorld.Runtime::InfiniteWorld.VoxelWorld.VoxelWorldGenerator - streamTarget: {fileID: 1331065949} - config: {fileID: 11400000, guid: b8cf28a5522134b479c23f017234070c, type: 2} ---- !u!4 &1842209028 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1842209026} serializedVersion: 2 - m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 74135865886311664, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 797018065588400165, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: m_Name + value: VoxelWorld + objectReference: {fileID: 0} + - target: {fileID: 2927522923773808063, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} + propertyPath: streamTarget + value: + objectReference: {fileID: 1331065949} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: 91b5caa5457131b4f8c542529f4ad7c3, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 m_Roots: - {fileID: 1331065949} - {fileID: 47249972} - - {fileID: 1842209028} + - {fileID: 6493552143235564167}