Version: Unity 6.6 Alpha (6000.6)
LanguageEnglish
  • C#

PhysicsShape.SetOwner

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static void SetOwner(ReadOnlySpan<PhysicsShape> shapes, Object owner, int ownerKey);

Parameters

Parameter Description
shapes The shapes to set ownership for.
owner The object that owns this key. Whilst it is valid to not specify an owner object (NULL), it is recommended for debugging purposes.
ownerKey The owner key to be used. The value must be non-zero. You can use PhysicsWorld.CreateOwnerKey for this value although any non-zero integer will work.

Returns

void The owner key assigned.

Description

Set the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. Whilst it is valid to not specify an owner object (NULL), it is recommended for debugging purposes.


Declaration

public void SetOwner(Object owner, int ownerKey);

Parameters

Parameter Description
owner The object that owns this key. This can be NULL if not required but is recommended as the key is formed in part by the hash-code of the owner object.
ownerKey The owner key to be used. If zero then a new owner key is created. You can use PhysicsWorld.CreateOwnerKey for this value although any non-zero integer will work.

Returns

void The owner key assigned.

Description

Set the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. It is also valid to not specify an owner object (NULL) to simply gain an owner key however it can be useful, if simply for debugging purposes and discovery, to know which object is the owner.


Declaration

public int SetOwner(Object owner);

Parameters

Parameter Description
owner The object that owns this key. This can be NULL if not required but is recommended as the key is formed in part by the hash-code of the owner object.

Returns

int The owner key assigned.

Description

Set the owner object using the specified owner key. You can only set the owner once, multiple attempts will produce a warning. This call does not bind the lifetime of the specified owner object, it is simply a reference. It is also valid to not specify an owner object (NULL) to simply gain an owner key however it can be useful, if simply for debugging purposes and discovery, to know which object is the owner.