Wrapper around the Unity GameObject class. Every component in the world has a parent GameObject which it is tied to.
public GameObjectWrapper GetChildByName(string name)
(Client) Get the child of an object by its name.
Arguments
Returns: (GameObject) The child game object.
public GameObjectWrapper GetChildByIndex(int index)
(Client) Get the child of an object by its index.
Arguments
Returns: (GameObject) The child game object.
public bool IsActive()
(Client) Is this game object active?
Returns: (bool) Whether this game object is considered to be active.
public void SetActive(bool active)
(Client) Set whether this game object is active.
Arguments
public bool IsObjectNetworked()
(Client) Is this game object networked?
Returns: (bool) Whether this game object is networked.
public uint GetNetworkID()
(Client) Get the network ID of this game object.
Returns: (uint) The network ID of this object if it's networked, the max value of uint if it isn't.
public TransformWrapper GetTransform()
(Client) Get the transform of this game object.
Returns: (Transform) The transform.
public string GetTag()
(Client) Gets the tag of this object.
Returns: (string) The tag.
public void SetTag(string tag)
(Client) Sets the tag of this object.
Arguments
public bool CompareTag(string tag)
(Client) Compares the tag of this object to another one.
Arguments
Returns: (bool) Whether they're the same.
public void EnableCollision(bool enabled)
(Client) Enables collision for this game object (on the condition it contains a renderer).
Arguments
public void IgnoreCollisionFrom(GameObjectWrapper gameObject, bool ignore)
(Client) Makes this game object ignore collisions with another game object.
Arguments
(GameObject) The game object to ignore collisions with. [gameObject]
(bool) Whether to ignore collisions. [ignore]
public void MakeUsable(string useMessage, bool disableAfterUse)
(Client) Turns this game object useable.
Every time a client uses it, it will send the "EntityUsed" payload.
Arguments
(string) The message to show when using. [useMessage]
(bool) Whether this should be single use only. [disableAfterUse]
public void SetUsageAllowed(bool allowed)
(Client) Sets whether the usage of this object is allowed.
Arguments
public void MakePlayerBarrier()
(Client) Make the collision of this game object only interact with players, allowing other collisions (like projectiles) to pass through.
public void IgnorePlayersAndProjectiles()
(Client) Make the collision of this game object only interact with raycasts, ignoring players and projectiles.
public void MakeProp(LuaVector3 positionConstraints, LuaVector3 rotationConstraints, float weightMultiplier = 1f, float sleepingVelocity = 0.5f)
(Client) Turns on physics for this game object. Props are not synced.
Arguments
(Vector3) Freeze position on each axis. Values greather than zero will freeze the position on the corresponding axis. [positionConstraints]
(Vector3) Freeze rotation on each axis. Values greather than zero will freeze the rotation on the corresponding axis. [rotationConstraints]
(float) Multiplies the effect gravity has on this prop. [weightMultiplier]
(float) The velocity at which gravity will stop trying to pull down this prop. [sleepingVelocity]
public void ListenToCollisions(bool addPlayerTrigger = false, float boundsMultiplier = 1.025f)
(Client) Makes this object listen for collisions.
When a collision is detected with this object, it will send the "ObjectCollision" payload.
Arguments
(bool) Players cannot be detected through regular collisions. Set this optional parameter to true to create a box trigger that will scale to the model's bounds to detect player collisions. [addPlayerTrigger]
(float) Multiplies the size of the model's bounds when calculating player trigger (if addPlayerTrigger is set to true). [boundsMultiplier]
public RectTransformWrapper GetRectTransform()
(Client) Get the rect transform of this object. This is only valid for UI elements.
Returns: (RectTransform) The rect transform.
public MeshRendererWrapper GetMeshRenderer()
(Client) Get the Mesh Renderer of this game object.
Returns: (MeshRenderer) The mesh renderer.