bool IsProxy { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The IsProxy property of the Component class indicates whether the component is part of a networked object that is owned by another client. If this property is true, it means that the object is not controlled by the local client, and therefore, any attempts to move or manipulate it directly should be avoided.

Usage

Use the IsProxy property to determine if a component is a proxy for a networked object owned by another client. This is particularly useful in multiplayer scenarios where objects are synchronized across different clients, and you need to ensure that only the owning client can control the object.

Example

// Example of checking if a component is a proxy
Component myComponent = someGameObject.GetComponent<Component>();

if (myComponent.IsProxy)
{
    // This object is controlled by another client
    // Avoid direct manipulation
    return;
}

// Safe to manipulate the object
myComponent.Transform.Position += new Vector3(1, 0, 0);