Version: Unity 7.0 Alpha (7000.0)
LanguageEnglish
  • C#

PhysicsShape.SetPhysicsGroup

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static int SetPhysicsGroup(ReadOnlySpan<PhysicsShape> shapes, PhysicsGroup physicsGroup);

Parameters

Parameter Description
shapes The shapes to set the group on.
physicsGroup The group to set on every shape.

Returns

int The number of shapes that were ignored (not set because the shape was invalid or already had a group). A single warning is logged when any are ignored. If the group is empty, nothing is set and every shape is counted as ignored.

Description

Set the same PhysicsGroup on a batch of shapes. Each shape is assigned the group as PhysicsShape.physicsGroup would, and a shape that already has a group is left unchanged.

Every shape given the same group must belong to the same body, otherwise the first and last marking of their events is unreliable. Shapes on more than one body are still assigned the group, and a single warning is logged. See PhysicsGroup and PhysicsWorld.CreateGroup.