• Studio

  • Studio API

  • Bots

  • Web API

  • Designer Resources

  • Host Resources

  • Component

    Inherits from: Object

    Component acts as the core of GameObject customization, enabling GameObjects to exhibit specific characteristics and behaviors. It's the foundation for a wide range of functionalities, from physics interactions with Collider to visual presentations via MeshRenderer and Camera components. Components transform GameObjects from static entities to dynamic actors within the game world. Scripting through LuaBehaviour further expands potential behaviors, allowing for unique game mechanics and interactions. Components are pivotal for developing immersive, interactive game environments. Explore Unity's Component documentation for detailed insights.

    Properties

    ServerAndClient

    Provides access to the GameObject's Transform, facilitating position, rotation, and scale adjustments.

    ServerAndClient

    Allows access to the GameObject this component is attached to, central to numerous Unity operations.

    tag

    string

    Accesses the GameObject's tag for identification and selection purposes within Unity's environment.

    Methods

    Retrieves a component of a specified type from the GameObject, crucial for accessing and manipulating attached components.

    Parameters

    type
    Type

    Component type to retrieve.

    Returns

    Component

    The component, if present.

    Searches the GameObject's children for a component of a specific type, extending component access to child GameObjects.

    Parameters

    Component type to search for in children.

    includeInactive

    boolean

    Includes inactive GameObjects in the search.

    Returns

    Component

    The component, if found among children.

    Looks for a specified component type in the GameObject's parent hierarchy, useful for accessing shared components in parent objects.

    Parameters

    Component type to search for in parents.

    includeInactive

    boolean

    Includes inactive GameObjects in the search.

    Returns

    Component

    The component, if located in a parent.

    Retrieves the index of a component, enabling more advanced management of multiple components of the same type.

    Returns

    number

    The index of the component.

    Compares the GameObject's tag with a specified string, streamlining GameObject categorization and behavior customization based on tags.

    Parameters

    tag

    string

    Tag for comparison.

    Returns

    boolean

    True if tags match, otherwise false.

    Updated about 1 month ago

    PocketWorlds Icon

    © 2024 Pocket Worlds. All rights reserved.