GameObject GroundObject { get; set; }

robot_2Generated
code_blocksInput

Description

The GroundObject property of the PlayerController class represents the GameObject that the player is currently standing on. If the player is not standing on any object, this property will be null.

Usage

Use the GroundObject property to determine what object the player is currently standing on. This can be useful for implementing game mechanics that depend on the type of surface the player is interacting with, such as different movement speeds or sound effects.

Example

// Example of using GroundObject property

PlayerController playerController = new PlayerController();

// Check if the player is standing on an object
if (playerController.GroundObject != null)
{
    // Get the name of the object the player is standing on
    string groundObjectName = playerController.GroundObject.Name;
    
    // Perform actions based on the ground object
    Console.WriteLine($"Player is standing on: {groundObjectName}");
}
else
{
    Console.WriteLine("Player is not standing on any object.");
}