# ISubAssetAware

Implement this interface in your ScriptableObjects, to make them compatible with the editor workflows of SubAssets Toolbox. By implementing these methods every time a sub-asset is added or removed in any way, the object can react and save a reference to it (or perform any other setup action).

For an example implementation, import the [SubAsset Aware Scriptable Object](https://tools.continis.io/subassets-toolbox/samples/subassetawareso) sample, and take a look at the `SubAssetAwareSO` class.

***

### AddSubAsset

```csharp
public void AddSubAsset(Object newSubAsset);
```

An object has been added as a sub-asset.

In your implementation, you should insert the new object into any List, array, Dictionary, or any data structure that allows you to retrieve the sub-asset at a later stage.

### RemoveSubAsset

```csharp
public void RemoveSubAsset(Object removedSubAsset);
```

A sub-asset will be removed.

In your implementation, you should ensure that the reference to the destroyed object is removed from whatever data structure was referencing it.

When this method is invoked as part of the API included in SubAssets Toolbox the sub-asset hasn't been destroyed yet, so you can inspect it if needed.
