> 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.ksnewprefabwatcher.md).

# Class ksNewPrefabWatcher

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

Detects when a new prefab is created and clears asset and shape IDs on the prefab. This is to prevent ID collisions when a new prefab is created from another prefab.

```csharp
public class ksNewPrefabWatcher : AssetModificationProcessor
```

#### Inheritance

[object](https://learn.microsoft.com/dotnet/api/system.object) ← AssetModificationProcessor ← [ksNewPrefabWatcher](/reactor/api-reference/ks.reactor.client.unity.editor/ks.reactor.client.unity.editor.ksnewprefabwatcher.md)

#### Inherited Members

[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)

## Methods

### Ignore(string) <a href="#ks_reactor_client_unity_editor_ksnewprefabwatcher_ignore_system_string" id="ks_reactor_client_unity_editor_ksnewprefabwatcher_ignore_system_string"></a>

Tells the watcher to ignore the next time a prefab is created at the given path. Use this to prevent the asset id of the new prefab from being cleared.

```csharp
public static void Ignore(string path)
```

#### Parameters

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

Path to ignore.

### OnWillCreateAsset(string) <a href="#ks_reactor_client_unity_editor_ksnewprefabwatcher_onwillcreateasset_system_string" id="ks_reactor_client_unity_editor_ksnewprefabwatcher_onwillcreateasset_system_string"></a>

Called before a new asset is created. If the asset is a prefab, stores the path so we can clear the IDs and check the path on the prefab once it is created.

```csharp
public static void OnWillCreateAsset(string path)
```

#### Parameters

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

Path that will be created.

### OnWillMoveAsset(string, string) <a href="#ks_reactor_client_unity_editor_ksnewprefabwatcher_onwillmoveasset_system_string_system_string" id="ks_reactor_client_unity_editor_ksnewprefabwatcher_onwillmoveasset_system_string_system_string"></a>

Called before an asset is moved. If the asset if a prefab, stores the path so we can check the path once it is moved.

```csharp
public static AssetMoveResult OnWillMoveAsset(string sourcePath, string destinationPath)
```

#### Parameters

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

Original path to the asset.

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

New path to the asset.

#### Returns

AssetMoveResult

Always returns AssetMoveResult.DidNotMove
