Method TrySetParent
TrySetParent(Transform, bool)
Set the parent of the NetworkObject transform.
Declaration
public bool TrySetParent(Transform parent, bool worldPositionStays = true)
Parameters
| Type | Name | Description |
|---|---|---|
| Transform | parent | The new parent for this NetworkObject transform will be the child of. |
| bool | worldPositionStays | If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before. |
Returns
| Type | Description |
|---|---|
| bool | Whether or not reparenting was successful. |
TrySetParent(GameObject, bool)
Set the parent of the NetworkObject transform.
Declaration
public bool TrySetParent(GameObject parent, bool worldPositionStays = true)
Parameters
| Type | Name | Description |
|---|---|---|
| GameObject | parent | The new parent for this NetworkObject transform will be the child of. |
| bool | worldPositionStays | If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before. |
Returns
| Type | Description |
|---|---|
| bool | Whether or not reparenting was successful. |
TrySetParent(NetworkObject, bool)
Set the parent of the NetworkObject transform.
Declaration
public bool TrySetParent(NetworkObject parent, bool worldPositionStays = true)
Parameters
| Type | Name | Description |
|---|---|---|
| NetworkObject | parent | The new parent for this NetworkObject transform will be the child of. |
| bool | worldPositionStays | If true, the parent-relative position, scale and rotation are modified such that the object keeps the same world space position, rotation and scale as before. |
Returns
| Type | Description |
|---|---|
| bool | Whether or not reparenting was successful. |