Skip to main content

Common Issues - Shaders, Meshes & Textures

This page is dedicated to common issues surrounding shaders, meshes & textures. If you are experiencing an issue that does not relate to shaders or meshes or textures consider looking at one of the other pages in this section, which are also listed here.

Make sure to Update Playable!
A lot of times issues can be fixed by simply updating your plugin to the latest version, please make sure to check you are on the latest release version before looking further into this section. More info on how to do this here

Uncaught TypeError: vertex.v.color.copy is not a function#

This is likely occurring due to unsupported functionality attempting to be used in your build.

Possible solutions

  • If PopulateUIVertex() is not required for the playable, then remove the call to this line.

GetTopology error when trying to access the submesh triangle data when slicing a mesh#

This may be caused by trying to access and set submeshes from SetSubMeshes() and SubMeshDescriptor[], which aren't implemented in Luna as of now.

Possible solution:

  • You need to iterate through the SourceMesh.subMeshCount using mesh.SetIndices you can set the sub mesh topology up correctly.
mesh.subMeshCount = srcMesh.subMeshCount;for (int i = 0; i < srcMesh.subMeshCount; ++i>){  mesh.SetIndices( srcMesh.GetIndices(i), MeshTopology.Triangles, i );}

Texture Not Tiling via Shader Material#

This may be caused due to power of two textures not being able to be tiled.

Possible solution:

  • Make the texture into a power of two resolution: e.g. 512x512 or 1024x512

Cannot see textures (textures are too dark)#

This may be due to lighting being set to baked, but nothing has been baked.

Possible solution:

  • Change the light to real-time.

Texture has an unintended outline in Luna#

This may be due to the compression method used in Luna not working well with the shader.

Possible solution:

  • Disable compression for this particular texture.

Shader missing from build#

This may be due to not including the needed shader when the shader variant asset has been created in the Unity project. Or the Luna.shadervariants file was created which doesn’t included the needed shader.

Possible solution:

  • Delete the shader variant asset or Luna.shadervariants shader and see if the it gets added to the Luna build. Then re-create the shader variant file and ensure the required shader is added.
    Info on how to a create a shader variant for Luna can be found here, and info on how to create a Unity shader variant asset for Unity can be found here.

Cannot convert from UnityEngine.Vector3[] to System.Collections.Generic.List(UnityEngine.Vector3)#

When using a Vector3[] with UnityEngine.MeshFilter.mesh.SetVertices(...) it produces the following error:

Cannot convert from UnityEngine.Vector3[] to System.Collections.Generic.List<UnityEngine.Vector3>

This is likely happening due to our Engine not supporting use of a Vector3 with the SetVertices() method.

Possible Solution:

  • Convert to a list using List.AddRange(Array) and use the converted list instead.

Luna.shadervariants causes build to fail in Unity 2018#

This is likely happening due to an unsupported shader being included in your build.

Open your luna.log to see if an listed (located in the LunaTemp folder in the root of your Unity project).

Possible Solution:

  • Remove any references to the unsupported shader from the scene.

6 sided skybox mapping incorrectly#

This will be due to Luna not supporting 6 sided skyboxes at this point in time.

Possible solution:

  • Instead use any other type of skybox

Meshes stretched and deformed, not rendering correctly#

WebGL 1.0 has a 64’000 vertex limit per draw call, going over that can cause visual artefacts and meshes to be drawn in the wrong order. This overflow mostly happens during baking.

Possible solution:

  • Stay below 64k vertices per draw call by optimizing meshes to lower their polycount or splitting them into smaller chunks: Blender has tools to weld vertices together based on distance, and to decimate them, which help reduce the amount of vertices without sacrificing visual quality. You can view the amount of vertices in Unity in the Inspector panel by clicking on the mesh in the Project window.

Cant change shader property on Skinned Mesh Renderer using MaterialPropertyBlock#

This is a known issue. Currently Luna doesn’t support GetPropertyBlock() for a SkinnedMeshRenderer, only for MeshRenderer.

Possible solutions:

  • Change the individual shader attribute directly instead of using GetPropertyBlock, e.g. cubeRenderer.material.SetColor("_Color", );
  • Use a MeshRenderer component instead of a SkinnedMeshRenderer if possible.

Enabling fog via a script causes shader errors in Luna#

This is likely happening because by default Unity doesn't include all the shader variants for each fog variant, so when you switch fog types in runtime there's no shader for this particular variant and a pink replacement shader appears.

Possible solution:

  • Enable fog via the lighting settings window instead. (Window -> Rendering -> Lighting Settings)