SetSurfaceMaterial
Set the PhysicsShape.SurfaceMaterial on a batch of shapes. The shapes and surfaceMaterials spans must be the same length; shapes[n] receives surfaceMaterials[n].
Read time 1 minuteLast updated a day ago
Definition
- Type: Method
- Namespace: Unity.U2D.Physics
- Assembly: UnityEngine.PhysicsCore2DModule
SetSurfaceMaterial(ReadOnlySpan<PhysicsShape>, ReadOnlySpan<SurfaceMaterial>)
Set the PhysicsShape.SurfaceMaterial on a batch of shapes. The shapes and surfaceMaterials spans must be the same length; shapes[n] receives surfaceMaterials[n].
public static int SetSurfaceMaterial(ReadOnlySpan<PhysicsShape> shapes, ReadOnlySpan<PhysicsShape.SurfaceMaterial> surfaceMaterials)
Parameters
The shapes to set the surface material on.
The surface materials to set, one entry per shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). A single warning is logged when any are ignored. If the spans are different lengths, nothing is set and every shape is counted as ignored. |
SetSurfaceMaterial(ReadOnlySpan<PhysicsShape>, SurfaceMaterial)
Set the same PhysicsShape.SurfaceMaterial on a batch of shapes.
public static int SetSurfaceMaterial(ReadOnlySpan<PhysicsShape> shapes, PhysicsShape.SurfaceMaterial surfaceMaterial)
Parameters
The shapes to set the surface material on.
The surface material to set on every shape.
Returns
Type | Description |
|---|---|
| int | The number of shapes that were ignored (not set because the shape was invalid). A single warning is logged when any are ignored. |