Extension Methods

All Extension Methods available by default in FPS Framework

Extension methods are a way of expanding the functionality of a class without editing that class or adding a single line to it. To learn more you would want to watch this:

Extension methods explained by unity

List of functions

The complete list of every function and its role that is distinct from each class.

Component

Function Name
Functionality

SearchFor<Type>()

Searches for the "Type" component on the same object; if it cannot be found, it looks for the component in the children; if still not found, it looks for the component in the parent.

SearchFor(Type)

Searches for the "Type" component on the same object; if it cannot be found, it looks for the component in the children; if still not found, it looks for the component in the parent.

Transform

Function Name
Functionality

SetPosition(Vector3 position, bool local)

Sets transform position to given position. If local is set to true, the function will set local position instead.

SetRotation(Quaternion rotation, bool local)

Sets transform rotation to given position. If local is set to true, the function will set local position instead.

Reset()

Resets transform position, rotation& scale

CreateChild()

Adds a new game object as a child of the transform, with the default name "GameObject"

CreateChild(string name)

Adds a new game object as a child of the transform, with the name given in the parameter "name"

CreateChildren(string[] names, bool parentAll)

Adds a list of new game object as children of the transform, with the names given in the parameter "names". If parentAll is true, each new child will be parented it the child before it.

ClearChildren()

Destroys all children in transform

SetPositionAndRotation(Vector3 position, Quaternion rotation, bool local)

Sets transform position and rotation to given position and rotation. If local is set to true, the function will set local position instead.

SetPositionAndRotation(Vector3 position, Vector3 eulerAngles, bool local)

Sets transform position and euler angles to given position and rotation. If local is set to true, the function will set local position instead.

GetDirection(Vector3Direction direction)

Returns a vector for the given direction. I direction is set to Vector3Direction.Up it will return, transform.up.

Character Controller

Function Name
Functionality

IsVelocityZero()

Returns true of the character controller isn't moving.

Rigidbody

Function Name
Functionality

IsVelocityZero()

Returns true of the rigidbody isn't moving.

Function Name
Functionality

AddOption(string option)

Adds a new option to the dropdown without having to create an OptionData. The "option" is the text that is going to be added as a new option

Input Action

Function Name
Functionality

HasDoupleClicked(ref bool targetValue, ref float lastClickTime, float maxClickTime)

Sets the "targetValue" to true of the input action has been triggered twice in a given time.

Resolution

Function Name
Functionality

GetDetails()

Returns a string with the resolution and refresh rate, given like this: 1920x1080 165Hz

Last updated

Was this helpful?