> For the complete documentation index, see [llms.txt](https://akila.gitbook.io/fps-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://akila.gitbook.io/fps-framework/tutorials/tools/extension-methods.md).

# Extension Methods

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:

{% embed url="<https://www.youtube.com/watch?v=C7mdDB3zY1A>" %}
Extension methods explained by unity
{% endembed %}

## List of functions

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

### Component

<table><thead><tr><th width="228">Function Name</th><th width="518">Functionality</th></tr></thead><tbody><tr><td>SearchFor&#x3C;Type>()</td><td>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.</td></tr><tr><td>SearchFor(Type)</td><td>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.</td></tr></tbody></table>

### Transform

<table><thead><tr><th width="442">Function Name</th><th>Functionality</th></tr></thead><tbody><tr><td>SetPosition(Vector3 position, bool local)</td><td>Sets transform position to given position. If local is set to true, the function will set local position instead.</td></tr><tr><td>SetRotation(Quaternion rotation, bool local)</td><td>Sets transform rotation to given position. If local is set to true, the function will set local position instead.</td></tr><tr><td>Reset()</td><td>Resets transform position, rotation&#x26; scale</td></tr><tr><td>CreateChild()</td><td>Adds a new game object as a child of the transform, with the default name "GameObject"</td></tr><tr><td>CreateChild(string name)</td><td>Adds a new game object as a child of the transform, with the name given in the parameter "name"</td></tr><tr><td>CreateChildren(string[] names, bool parentAll)</td><td>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.</td></tr><tr><td>ClearChildren()</td><td>Destroys all children in transform</td></tr><tr><td>SetPositionAndRotation(Vector3 position, Quaternion rotation, bool local)</td><td>Sets transform position and rotation to given position and rotation. If local is set to true, the function will set local position instead.</td></tr><tr><td>SetPositionAndRotation(Vector3 position, Vector3 eulerAngles, bool local)</td><td>Sets transform position and euler angles to given position and rotation. If local is set to true, the function will set local position instead.</td></tr><tr><td>GetDirection(Vector3Direction direction)</td><td>Returns a vector for the given direction. I direction is set to Vector3Direction.Up it will return, transform.up.</td></tr></tbody></table>

### Character Controller

<table><thead><tr><th width="252">Function Name</th><th>Functionality</th></tr></thead><tbody><tr><td>IsVelocityZero()</td><td>Returns true of the character controller isn't moving.</td></tr></tbody></table>

### Rigidbody

<table><thead><tr><th width="258">Function Name</th><th>Functionality</th></tr></thead><tbody><tr><td>IsVelocityZero()</td><td>Returns true of the rigidbody isn't moving.</td></tr></tbody></table>

### Dropdown

<table><thead><tr><th width="234">Function Name</th><th>Functionality</th></tr></thead><tbody><tr><td>AddOption(string option)</td><td>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</td></tr></tbody></table>

### Input Action

<table><thead><tr><th width="337">Function Name</th><th>Functionality</th></tr></thead><tbody><tr><td>HasDoupleClicked(ref bool targetValue, ref float lastClickTime, float maxClickTime)</td><td>Sets the "targetValue" to true of the input action has been triggered twice in a given time.</td></tr></tbody></table>

### Resolution

| Function Name | Functionality                                                                           |
| ------------- | --------------------------------------------------------------------------------------- |
| GetDetails()  | Returns a string with the resolution and refresh rate, given like this: 1920x1080 165Hz |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://akila.gitbook.io/fps-framework/tutorials/tools/extension-methods.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
