Surface Impacts
The Surface Impact Scriptable Object is used to identify different collision types for surface effect purposes. It declares (by filename) a particular type of collision that will be used to trigger effects when sent to a collider that has a Surface Type.
Example Surface Impacts are bullet hit, melee impact, fall impact, footstep, etc. When a bullet hits a rock, the Surface Impact is what makes the Surface Manager spawn sparks, dust, and a ricochet sound instead of footstep effects. This is achieved by binding the Surface Impact object to a Surface Effect object by an encompassing Surface Type object.
The Surface Impact script doesn’t actually do anything. It is just used as an identifier object for a certain type of impact. Of course, at runtime the Surface Impact object plays a very important within the larger Surface System.
Creating a new Surface Impact
A new Surface Impact can be created from the Assets -> Create -> Ultimate Character Controller -> Surface Impact menu option. This menu is also available when you right click within the project view. However, you may find it easier to just duplicate an existing effect.
After you have created a new Surface Impact it must be assigned in at least two places:
- The object that is actually using the Surface Impact, such as the bullet, footstep, or ability.
- A Surface Type object which binds a Surface Impact to a Surface Effect. Alternatively the Surface Impact can be set as the default Fallback on the Surface Manager component.
Fallback Surface Impact
You can set a scene-wide fallback Surface Impact within the Surface Manager – Fallbacks foldout. This can be used for cases where the Surface Impact is unknown (such as if a Surface Impact wasn’t set on a bullet component).