Skip to content

format

typescript
Vector3.Set(index, value)

class: Vector3

description

Set the x, y, and z components of the vector based on the index.

parameter

param_nametypedescription
indexnumberThe index of the component.
valuenumberThe value of the component.

reture

typedescription
void

code example

typescript
let a = new Vector3(1,2,3);
 // Set the x component of the vector
a.Set(0,2);
  // Set the y component of the vector
a.Set(1,2);
// Set the z component of the vector
a.Set(2,2);
Debug.Log("a is",a);