string LeftMouseAction { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The LeftMouseAction property of the WorldInput class specifies the action associated with the left mouse button click. This property is used to define what happens when the user clicks the left mouse button within the game world. It is a string value that can be set to represent different actions, such as selecting an object, interacting with the environment, or any custom action defined by the developer.

Usage

To use the LeftMouseAction property, you need to have an instance of the WorldInput component, typically attached to your player's camera. You can then set or get the action associated with the left mouse button click as follows:

WorldInput worldInput = playerCamera.GetComponent<WorldInput>();
worldInput.LeftMouseAction = "SelectObject"; // Set the action for left mouse click
string action = worldInput.LeftMouseAction; // Retrieve the current action

Example

// Example of setting the LeftMouseAction property
WorldInput worldInput = playerCamera.GetComponent<WorldInput>();

// Set the action for the left mouse button to "Interact"
worldInput.LeftMouseAction = "Interact";

// Retrieve and print the current action for the left mouse button
string currentAction = worldInput.LeftMouseAction;
// Use the currentAction variable as needed in your game logic