diff --git a/CHANGELOG.md b/CHANGELOG.md
index 239ed51a..38f83584 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,10 @@
# Change Log
+#### v1.8.4 - Jan 24, 2024
+
+- added asset lifetime sample script
+- updated documentation
+
#### v1.8.3 - Jan 22, 2024
- Importer tests: disable some tests in 2021.3 because the method is not available
diff --git a/Samples~/CreateAndDelete/CodeSmileAssetDatabaseExamples.cs b/Samples~/CreateAndDelete/CodeSmileAssetDatabaseExamples.cs
new file mode 100644
index 00000000..94e10318
--- /dev/null
+++ b/Samples~/CreateAndDelete/CodeSmileAssetDatabaseExamples.cs
@@ -0,0 +1,41 @@
+// Copyright (C) 2021-2024 Steffen Itterheim
+// Refer to included LICENSE file for terms and conditions.
+
+using CodeSmileEditor;
+using System;
+using System.IO;
+using UnityEditor;
+using UnityEngine;
+
+public static class CodeSmileAssetDatabaseExamples
+{
+ private const String TestFolder = "Assets/_sub_folder_";
+
+ ///
+ /// For more usage examples please refer to the numerous Unit Tests:
+ /// Packages/CodeSmile AssetDatabase/Tests/Editor/*.cs
+ ///
+ /// API reference: https://codesmile-0000011110110111.github.io/de.codesmile.assetdatabase
+ [MenuItem("Window/CodeSmile/AssetDatabase Examples/Create and Delete Asset")]
+ private static void CreateAndDeleteAsset()
+ {
+ var path = $"{TestFolder}/TestAsset.asset";
+ var asset = new Asset(ScriptableObject.CreateInstance(), path);
+
+ var instance = asset.MainObject;
+ var assetPath = asset.AssetPath;
+ Debug.Log($"Asset '{instance}' created at '{assetPath}'");
+
+ var message = asset.GetMain().Message;
+ Debug.Log($"Asset says: '{message}'");
+
+ asset.Delete();
+ Debug.Log($"Asset deleted: {asset.IsDeleted}");
+
+ // a folder is an asset, too!
+ var folder = new Asset(TestFolder);
+ folder.Delete();
+
+ Debug.Log($"Testfolder removed: {!Directory.Exists(TestFolder)}");
+ }
+}
diff --git a/Samples~/CreateAndDelete/CodeSmileAssetDatabaseExamples.cs.meta b/Samples~/CreateAndDelete/CodeSmileAssetDatabaseExamples.cs.meta
new file mode 100644
index 00000000..eab3dd15
--- /dev/null
+++ b/Samples~/CreateAndDelete/CodeSmileAssetDatabaseExamples.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0a85d9e357ab29646aea86835314e8a2
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/CreateAndDelete/CodeSmileEditor.AssetDatabase.Examples.asmdef b/Samples~/CreateAndDelete/CodeSmileEditor.AssetDatabase.Examples.asmdef
new file mode 100644
index 00000000..39f2fa4d
--- /dev/null
+++ b/Samples~/CreateAndDelete/CodeSmileEditor.AssetDatabase.Examples.asmdef
@@ -0,0 +1,18 @@
+{
+ "name": "CodeSmileEditor.AssetDatabase.Examples",
+ "rootNamespace": "",
+ "references": [
+ "GUID:38cc5939e6694a64d8d6ea3aaca03495"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": [],
+ "versionDefines": [],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/Samples~/CreateAndDelete/CodeSmileEditor.AssetDatabase.Examples.asmdef.meta b/Samples~/CreateAndDelete/CodeSmileEditor.AssetDatabase.Examples.asmdef.meta
new file mode 100644
index 00000000..b419f3da
--- /dev/null
+++ b/Samples~/CreateAndDelete/CodeSmileEditor.AssetDatabase.Examples.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 8bd3730a67b4b134696696498341c02b
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Samples~/CreateAndDelete/TestAsset.cs b/Samples~/CreateAndDelete/TestAsset.cs
new file mode 100644
index 00000000..345ca1f7
--- /dev/null
+++ b/Samples~/CreateAndDelete/TestAsset.cs
@@ -0,0 +1,12 @@
+// Copyright (C) 2021-2024 Steffen Itterheim
+// Refer to included LICENSE file for terms and conditions.
+
+using System;
+using UnityEngine;
+
+public class TestAsset : ScriptableObject
+{
+ public String Message = "To be, or not to be: that is not a question.";
+
+ private void OnEnable() => name = "Test ScriptableObject";
+}
diff --git a/Samples~/CreateAndDelete/TestAsset.cs.meta b/Samples~/CreateAndDelete/TestAsset.cs.meta
new file mode 100644
index 00000000..eb6adef6
--- /dev/null
+++ b/Samples~/CreateAndDelete/TestAsset.cs.meta
@@ -0,0 +1,3 @@
+fileFormatVersion: 2
+guid: 5d28ff5a9e9d42f4a6b2a91b872efc48
+timeCreated: 1706105966
\ No newline at end of file
diff --git a/package.json b/package.json
index 02fdf0ab..ca6411e5 100644
--- a/package.json
+++ b/package.json
@@ -1,8 +1,8 @@
{
"name": "de.codesmile.assetdatabase",
"displayName": "CodeSmile AssetDatabase",
- "description": "Accessible 'clean code' version of Unity's ~20 year old AssetDatabase class and related functionality.\n\nPublished under multiple licenses:\n- GPL 3.0 for personal & educational use\n- Custom licensing for Asset Publishers & Sponsors (contact me)\n- Asset Store Terms and EULA for most other uses",
- "version": "1.8.3",
+ "description": "The AssetDatabase in enjoyable, consistent, concise, convenient, comprehensible, safe, documented form.\n\nAvailable under multiple licenses:\n- GPL 3.0 for personal & educational use\n- Asset Store Terms and EULA for commercial use",
+ "version": "1.8.4",
"unity": "2021.3",
"unityRelease": "3f1",
"author": {
@@ -16,5 +16,12 @@
"dependencies": {
"com.unity.test-framework": "1.4.1"
},
- "relatedPackages": {}
+ "relatedPackages": {},
+ "samples": [
+ {
+ "displayName": "Create and Delete Asset",
+ "description": "Basic asset lifetime example.",
+ "path": "Samples~/CreateAndDelete"
+ }
+ ]
}