CodeSmile AssetDatabase 1.9
Unity's AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.
Loading...
Searching...
No Matches

◆ Add()

static void Add ( [NotNull] Object subAssetInstance,
[NotNull] Object asset )
static

Adds an object as sub-asset to the asset. This change is implicitly saved to disk.

You do NOT need to call Save() afterwards.

Parameters
subAssetInstanceThe object to add as a sub-asset. It must not already be an asset.
assetInstance of an asset.
See also

Definition at line 58 of file Asset.SubAsset.cs.

59 {
60 ThrowIf.ArgumentIsNull(subAssetInstance, nameof(subAssetInstance));
61 ThrowIf.SubObjectIsGameObject(subAssetInstance);
62 ThrowIf.AlreadyAnAsset(subAssetInstance);
63 ThrowIf.ArgumentIsNull(asset, nameof(asset));
64
65 AssetDatabase.AddObjectToAsset(subAssetInstance, asset);
66 }