> For the complete documentation index, see [llms.txt](https://kinematicsoup.gitbook.io/reactor/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kinematicsoup.gitbook.io/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspredictortemplate.md).

# Class ksPredictorTemplate

Namespace: [KS.Reactor.Client.Unity.Editor](/reactor/api-reference/ks.reactor.client.unity.editor.md)\
Assembly: KSUnity-Source.dll

Template for generating predictor scripts.

```csharp
public class ksPredictorTemplate : ScriptableObject, ksIScriptTemplate
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← Object ← ScriptableObject ← [ksPredictorTemplate](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspredictortemplate.md)

#### Implements

[ksIScriptTemplate](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.ksiscripttemplate.md)

#### Inherited Members

ScriptableObject.SetDirty(), ScriptableObject.CreateInstance(string), ScriptableObject.CreateInstance(Type), ScriptableObject.CreateInstance\<T>(), Object.GetInstanceID(), Object.GetHashCode(), Object.Equals(object), Object.Instantiate(Object, Vector3, Quaternion), Object.Instantiate(Object, Vector3, Quaternion, Transform), Object.Instantiate(Object), Object.Instantiate(Object, Transform), Object.Instantiate(Object, Transform, bool), Object.Instantiate\<T>(T), Object.Instantiate\<T>(T, Vector3, Quaternion), Object.Instantiate\<T>(T, Vector3, Quaternion, Transform), Object.Instantiate\<T>(T, Transform), Object.Instantiate\<T>(T, Transform, bool), Object.Destroy(Object, float), Object.Destroy(Object), Object.DestroyImmediate(Object, bool), Object.DestroyImmediate(Object), Object.FindObjectsOfType(Type), Object.FindObjectsOfType(Type, bool), Object.FindObjectsByType(Type, FindObjectsSortMode), Object.FindObjectsByType(Type, FindObjectsInactive, FindObjectsSortMode), Object.DontDestroyOnLoad(Object), Object.DestroyObject(Object, float), Object.DestroyObject(Object), Object.FindSceneObjectsOfType(Type), Object.FindObjectsOfTypeIncludingAssets(Type), Object.FindObjectsOfType\<T>(), Object.FindObjectsByType\<T>(FindObjectsSortMode), Object.FindObjectsOfType\<T>(bool), Object.FindObjectsByType\<T>(FindObjectsInactive, FindObjectsSortMode), Object.FindObjectOfType\<T>(), Object.FindObjectOfType\<T>(bool), Object.FindFirstObjectByType\<T>(), Object.FindAnyObjectByType\<T>(), Object.FindFirstObjectByType\<T>(FindObjectsInactive), Object.FindAnyObjectByType\<T>(FindObjectsInactive), Object.FindObjectsOfTypeAll(Type), Object.FindObjectOfType(Type), Object.FindFirstObjectByType(Type), Object.FindAnyObjectByType(Type), Object.FindObjectOfType(Type, bool), Object.FindFirstObjectByType(Type, FindObjectsInactive), Object.FindAnyObjectByType(Type, FindObjectsInactive), Object.ToString(), Object.name, Object.hideFlags, [object.Equals(object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object\)), [object.Equals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.equals#system-object-equals\(system-object-system-object\)), [object.GetHashCode()](https://learn.microsoft.com/dotnet/api/system.object.gethashcode), [object.GetType()](https://learn.microsoft.com/dotnet/api/system.object.gettype), [object.MemberwiseClone()](https://learn.microsoft.com/dotnet/api/system.object.memberwiseclone), [object.ReferenceEquals(object, object)](https://learn.microsoft.com/dotnet/api/system.object.referenceequals), [object.ToString()](https://learn.microsoft.com/dotnet/api/system.object.tostring)

## Properties

### DefaultFileName <a href="#ks_reactor_client_unity_editor_kspredictortemplate_defaultfilename" id="ks_reactor_client_unity_editor_kspredictortemplate_defaultfilename"></a>

Default file name for scripts generated from this template.

```csharp
public string DefaultFileName { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### DefaultPath <a href="#ks_reactor_client_unity_editor_kspredictortemplate_defaultpath" id="ks_reactor_client_unity_editor_kspredictortemplate_defaultpath"></a>

Default path for scripts generated from this template.

```csharp
public string DefaultPath { get; }
```

#### Property Value

[string](https://learn.microsoft.com/dotnet/api/system.string)

### Generator <a href="#ks_reactor_client_unity_editor_kspredictortemplate_generator" id="ks_reactor_client_unity_editor_kspredictortemplate_generator"></a>

Script generator

```csharp
public ksScriptGenerator Generator { get; set; }
```

#### Property Value

[ksScriptGenerator](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.ksscriptgenerator.md)

### OptionalMethods <a href="#ks_reactor_client_unity_editor_kspredictortemplate_optionalmethods" id="ks_reactor_client_unity_editor_kspredictortemplate_optionalmethods"></a>

Optional methods the template can generate.

```csharp
public ksOptionalMethod[] OptionalMethods { get; }
```

#### Property Value

[ksOptionalMethod](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.ksoptionalmethod.md)\[]

## Methods

### Generate(string, string, string, HashSet\<uint>) <a href="#ks_reactor_client_unity_editor_kspredictortemplate_generate_system_string_system_string_system_strin" id="ks_reactor_client_unity_editor_kspredictortemplate_generate_system_string_system_string_system_strin"></a>

Generates the contents of a script.

```csharp
public string Generate(string path, string className, string scriptNamespace, HashSet<uint> optionalMethods)
```

#### Parameters

`path` [string](https://learn.microsoft.com/dotnet/api/system.string)

Path the script will be written to.

`className` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name of generated class.

`scriptNamespace` [string](https://learn.microsoft.com/dotnet/api/system.string)

Namespace of generated class.

`optionalMethods` [HashSet](https://learn.microsoft.com/dotnet/api/system.collections.generic.hashset-1)<[uint](https://learn.microsoft.com/dotnet/api/system.uint32)>

Contains ids of optional method stubs to generate.

#### Returns

[string](https://learn.microsoft.com/dotnet/api/system.string)

Script contents

### HandleCreate(string, string, string) <a href="#ks_reactor_client_unity_editor_kspredictortemplate_handlecreate_system_string_system_string_system_s" id="ks_reactor_client_unity_editor_kspredictortemplate_handlecreate_system_string_system_string_system_s"></a>

Called after the script file is written.

```csharp
public void HandleCreate(string path, string className, string scriptNamespace)
```

#### Parameters

`path` [string](https://learn.microsoft.com/dotnet/api/system.string)

Path the script was written to.

`className` [string](https://learn.microsoft.com/dotnet/api/system.string)

Name of generated class.

`scriptNamespace` [string](https://learn.microsoft.com/dotnet/api/system.string)

Namespace of generated class.

### Initialize(GameObject\[]) <a href="#ks_reactor_client_unity_editor_kspredictortemplate_initialize_unityengine_gameobject" id="ks_reactor_client_unity_editor_kspredictortemplate_initialize_unityengine_gameobject"></a>

Initialization

```csharp
public ksPredictorTemplate Initialize(GameObject[] gameObjects = null)
```

#### Parameters

`gameObjects` GameObject\[]

Game objects to attach the script to once generated.

#### Returns

[ksPredictorTemplate](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.kspredictortemplate.md)

### OnEnable() <a href="#ks_reactor_client_unity_editor_kspredictortemplate_onenable" id="ks_reactor_client_unity_editor_kspredictortemplate_onenable"></a>

This function is called when the object becomes enabled and active.

```csharp
public void OnEnable()
```
