Surface Manager

The Surface Manager component can be used to trigger effects depending on the object texture, thus reducing the need for assigning a Surface Identifier to every GameObject in the scene. It also has default fallbacks for (potentially missing) Surface Impact and Surface Types.

The Surface Manager will try to determine the Surface Type of the object hit from various sources including single textures, textures among multi-materials, and terrain textures. It is also possible to define UV regions for textures inside the inspector (for atlas maps).

Object Surfaces

Click on the plus symbol of the reorderable list in order to add a new Object Surface. The Surface Type should be assigned along with a list of textures that correspond to that Surface Type.

The UV field allows for the surface to be restricted within a rectangular region inside a texture. The Object Surface element higher in the list will be selected if two Object Surfaces share the same texture and having overlapping UVs. If you want to have several surfaces inside a single texture then you should add that texture to each Object Surface Element.

Fallbacks

These fallbacks will be used when the system cannot determine the Surface Impact or Surface Type involved in an impact. Examples where this can happen include when a projectile does not have it’s Surface Impact set, or an impacted object does not have either a Surface Identifier or a texture fallback.

Fallbacks are very powerful as they allow you to provide rough behavior for all of the surfaces in your game with all of the effect combinations accounted for with an absolute minimum amount of work.

Fallback Surface Impact

The Surface Impact will be used when the Surface Impact is unknown (such as if a footstep or a projectile has no Surface Impact). This fallback will apply to all cases when the Surface Impact is unknown, unless a Surface Type has a Surface Effect assigned for its fallback.

Fallback Surface Type

The Surface Type will be used when the Surface Type is unknown (such as when an object has no Surface Identifier and there are no object or terrain Surface Types). Your fallback surface can be one of the existing surfaces, but it is important that all of the Surface Impacts are hooked up to a Surface Effect, including the Fallback Surface Impact.

Fallback Allow Decals

When Allow Decals is false (recommended) the default fallbacks will not be able to spawn decals, even if the Surface Effect has them. This will prevent fallback decals that don’t fit well with the target surface.

Stretched Decals

When a decal is added to an object it can be set to the child of that object. Due to Unity engine internals, childing a decal to an object with a non-uniform scale (meaning the x, y, and z scale are not identical) will result in decals that are strangely stretched/warped. Because of this objects that are non-uniform will only receive decals if the Allow Non Uniform Decals toggle is true within the Decal Manager.

The warping of the decals may be very slight and acceptable if the object has only slight scale deviations on one or more axes. If the scale deviations are considerable then the decals will start to look very deformed when they are parented. There are three workarounds for this:

  1. The target object should be marked as static if it will never move or be destroyed at runtime. This will allow all decals to appear normal on the surface even though they aren’t actually parented to the object.
  2. The Allow Non Uniform Decals option on the Decal Manager can be deselected to prevent decals from every being parented to a non-uniform object.
  3. A Surface Identifier can be added to control if decals should spawn on a per-object basis. The Allow Decals option can be deselected within the Surface Identifier which will prevent decals from being parented to that object.