Description
The Static
property of the Collider
class indicates whether the collider is static. A static collider does not move and is typically used for objects that are part of the environment, such as walls or floors. This property is a boolean value, where true
means the collider is static, and false
means it is not.
Usage
To use the Static
property, you can simply get or set its value on an instance of a Collider
object. Note that this property is hidden if the collider is concave, as indicated by the HideIfAttribute
with the condition IsConcave
.
Example
// Example of setting the Static property
Collider myCollider = new Collider();
myCollider.Static = true; // Set the collider to be static
// Example of checking if a collider is static
bool isStatic = myCollider.Static;
if (isStatic)
{
// Perform actions for static colliders
}