Advanced Surface System Topics

Surface Manager

Fallback Logic
  • If there is no Surface Impact but there is a Surface Type then the fallback Surface Impact will be used with the detected surface.
  • If there is no Surface Type but there is a Surface Impact then the detected Surface Impact will be used with the fallback Surface Type.
  • If there is no Surface Impact or Surface Type then the fallback Surface Impact will be used with the fallback Surface Type.
Limitations
  • For performance reasons the surface system relies heavily on caching. Because of this you cannot:
    • Manipulate the Surface Manager at runtime.
    • Change surface settings at runtime.
    • Manipulate hierarchies of any target object at runtime.
  • Due to Unity engine internals, childing a decal to an object with a non-uniform scale (the x, y, and z scales are not identical) will result in decals that are strangely stretched/warped on such objects.
  • UV regions on atlas textures do not work with Unity’s default primitives (cube, sphere, capsule, etc). It will only work on objects with a Mesh Filter and Mesh Renderer.
  • UV regions on atlas textures do not work on static objects.
  • Surface detection will not work if the collider is not static and the renderer is static.
  • Surface detection will not work with multiple materials in the following scenarios:
    • If the Renderer is static. This is because Unity merges the meshes of all of the static objects into a single mesh. Unfortunately, you must either make the renderer non-static or split the object into separate, single material static objects and assign the Surface Identifier to each.
    • If the GameObject has a Mesh Collider. This is because Unity creates separate meshes for each material under-the-hood when rendering. The Renderer and Collider must share the same logical mesh for Surface Effects to work with Mesh Colliders.
Troubleshooting

A level geometry exists whose material / shader does not have a texture. How should it be associated with a surface?

Add the Surface Identifier component to the object.

My fallback Surface Impact or Surface Type doesn’t work.

Ensure there is not a Surface Identifier on the object. This will override all fallback settings.

A Surface Identifier is on the object but it doesn’t work.

  1. Verify that you have assigned a Surface Type.
  2. If you want to received decals, verify that Allow Decals is enabled on the Surface Identifier.
  3. Verify that there is only one Surface Identifier on the object.
  4. Verify that the object has a uniform scale.

Surface Effects don’t work on static, multi-material / atlas map objects

This is a very unfortunate limitation due to Unity architecture. When you mark an object as rendering static then Unity will merge the meshes together in a way that prevents the surface system from deriving material info / texture coordinates for effect spawning. At the time of writing there are three known solutions to the problem:

  • Make the object non-static. This may be an acceptable solution if it’s not for all level geometry but just a few objects.
  • Place invisible, static colliders above floors or walls with a certain texture and assign a Surface Manager to the invisible object.
  • Don’t use multi-material objects, instead break the objects into separate, static objects.