-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a07dc0d
commit 356cdff
Showing
187 changed files
with
25,745 additions
and
489 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,27 +110,14 @@ <h1><a class="anchor" id="but--why"></a> | |
<p>For every task there is a single call and you are DONE!</p> | ||
<p>The structure and naming is intended to be EXTREMELY simple to find your way around and then to call the appropriate method with fewer parameters, with names that speak for themselves.</p> | ||
<p>No longer do you need to wonder what a 'valid folder' might be. Or ponder what it means to 'force reserialize all assets'.</p> | ||
<p>Let alone the ubiquitous 'SaveAllAssets' followed by 'Refresh' - are you calling that in your scripts? 99% chance you just put it there out of habit. You never gave it any thought. You have no idea what it really does. Not even that it can cripple editor performance. Or when calling it is <b>NOT</b> needed. (Hint: almost every time.)</p> | ||
<p>Let alone the ubiquitous 'SaveAllAssets' followed by 'Refresh' - are you calling that in your scripts? 99% chance you just put it there out of habit. You never gave it any thought. You have no idea what it really does. Not even that it can cripple editor performance. Or when calling it is indeed <b>required</b>. (Hint: almost never!)</p> | ||
<p>Or just being confused, once again, about whether you need to use <code>AssetDatabase.GetTextMetaFilePathFromAssetPath</code> or <code>AssetDatabase.GetAssetPathFromTextMetaFilePath</code>. Or the unholy trinity: <code>AssetPath.AssetPathToGUID</code>~<code>AssetPath.GUIDFromAssetPath</code>~<code>AssetPath.GUIDToAssetPath</code>.</p> | ||
<h1><a class="anchor" id="i-dont-trust-this-"></a> | ||
I don't trust this ..</h1> | ||
<p>The implementation is utmost CORRECT - there are no unnecessary, performance-degrading calls such as 'Refresh' and 'SaveAllAssets' littered throughout like you'll find in most editor scripts - unfortunately even in popular assets/libraries!</p> | ||
<p>It is also extensively unit TESTED to be correct.</p> | ||
<p>And I happen to love correct, clean code. Most developers move on when their code works. I cannot move on until I understand <b>why</b> my code works.</p> | ||
<h1><a class="anchor" id="what-about-support"></a> | ||
What about support?</h1> | ||
<p><a href="https://codesmile-0000011110110111.github.io/de.codesmile.assetdatabase/html/index.html" target="_blank">The documentation</a> is more complete with more details and caveats mentioned than Unity's.</p> | ||
<p>And if there's anything out of the ordinary, open an issue or <a href="mailto:[email protected]">contact me</a>. I also have a <a href="https://discord.gg/JN3Jz8qkeV" target="_blank">Discord channel</a>.</p> | ||
<h1><a class="anchor" id="example-code-snippets"></a> | ||
Example Code Snippets</h1> | ||
<p><code>Asset data = "Assets/Folder/Data.asset";</code> // Load an asset from its path</p> | ||
<p><code>data.ForceSave();</code> // mark asset as dirty and save it</p> | ||
<p><code>data.AddSubAsset(subData);</code> // Add a sub-asset (implicitly saved)</p> | ||
<p><code>data.ActiveImporter = typeof(MyDataImporter);</code> // Change asset's importer</p> | ||
<p><code>data.ExportPackage("I:/leveldata.unitypackage");</code> // Export as .unitypackage</p> | ||
<p><code>var dataObject = data.MainObject;</code> // Get asset's UnityEngine.Object instance</p> | ||
<p><code>var levelData = data.GetAs<LevelData>();</code> // Get it as specific type (may be null)</p> | ||
<p><code>var levelData = (LevelData)data;</code> // Cast to a type (may throw)</p> | ||
<p><code>var obj = Asset.File.Create(str, "Assets/Folder/Data.asset");</code> // Create (overwrite) asset from string</p> | ||
<p><code>var obj = Asset.File.CreateAsNew(bytes, "Assets/Folder/Data.asset");</code> // Create new asset from byte[]</p> | ||
<p><code>var asset = new Asset(bytes, "Assets/Folder/Data.asset");</code> // Same as above using Asset ctor</p> | ||
|
@@ -143,12 +130,34 @@ <h1><a class="anchor" id="example-code-snippets"></a> | |
<li>Load the new asset file</li> | ||
</ul> | ||
<p><code>var actualPath = asset.AssetPath;</code> // Filename might have changed, eg "Data (3).asset"</p> | ||
<p><code>asset.ExportPackage("I:/leveldata.unitypackage");</code> // Export as .unitypackage</p> | ||
<p><code>var obj = asset.MainObject;</code> // Get asset's UnityEngine.Object instance</p> | ||
<p><code>var levelData = asset.GetAs<LevelData>();</code> // Get it as specific type (may be null)</p> | ||
<p><code>var levelData = (LevelData)asset;</code> // Cast to a type (may throw)</p> | ||
<p><code>var subAssets = asset.SubAssets;</code> // Do I need to keep explaining these calls?</p> | ||
<p><code>var assetDupe = asset.Duplicate();</code> // Because you need a duplicate ..</p> | ||
<p><code>assetDupe.Delete();</code> // .. but then decided you don't.</p> | ||
<p><code>var newAsset = asset.SaveAsNew("Assets/Elsewhere/Daydah.asset");</code> // Now you want a copy?</p> | ||
<p><code>newAsset.Trash();</code> // Okay. Either you're bored or excited to work with the AssetDatabase for the first time EVER. :)</p> | ||
<p><code>Asset.File.BatchEditing(() => { /* mass file IO */ });</code> // Speed up calling many Asset.File.* methods (loop)</p> | ||
<p><code>Asset.File.Import(paths);</code> // Mass import of paths, batched internally</p> | ||
<p><code>var msg = Asset.GetLastErrorMessage();</code> // A file operation failed? Show this!</p> | ||
<h1><a class="anchor" id="i-dont-trust-this-"></a> | ||
I don't trust this ..</h1> | ||
<p>The implementation is utmost CORRECT - there are no unnecessary, performance-degrading calls such as 'Refresh' and 'SaveAllAssets' littered throughout like you'll find in most editor scripts - unfortunately even in popular assets/libraries!</p> | ||
<p>It is also extensively unit TESTED to be correct.</p> | ||
<p>And I happen to love correct, clean code. Most developers move on when their code works. I cannot move on until I understand <b>why</b> my code works.</p> | ||
<h1><a class="anchor" id="what-about-support"></a> | ||
What about support?</h1> | ||
<p><a href="https://codesmile-0000011110110111.github.io/de.codesmile.assetdatabase/html/index.html" target="_blank">The documentation</a> is more complete with more details and caveats mentioned than Unity's.</p> | ||
<p>And if there's anything out of the ordinary, open an issue or <a href="mailto:[email protected]">contact me</a>. I also have a <a href="https://discord.gg/JN3Jz8qkeV" target="_blank">Discord channel</a>.</p> | ||
<h1><a class="anchor" id="wheres-refresh"></a> | ||
Where's Refresh?</h1> | ||
<p>I did mention you don't need it, right? ;)</p> | ||
<p>But if you do, here's Waldo: <code>Asset.Database.ImportAll();</code></p> | ||
<p>Caution: This is an expensive (!) database operation in that it scans the ENTIRE "Assets" tree and tests ALL (!) files for changes made EXTERNALLY (eg System.IO methods, bash scripts).</p> | ||
<p>Refresh also unloads all unused (cached) resources, forcing them to be reloaded from disk on the next use. You can imagine how this has a negative impact on editor performance.</p> | ||
<p>Since Refresh() has been excessively overused I decided to name it closer to what it actually does.</p> | ||
<h1><a class="anchor" id="documentation"></a> | ||
Documentation</h1> | ||
<ul> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
html/md__p_1_2de_8codesmile_8assetdatabase_2_g_e_t_t_i_n_g_01_s_t_a_r_t_e_d.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> | ||
<meta http-equiv="X-UA-Compatible" content="IE=11"/> | ||
<meta name="generator" content="Doxygen 1.10.0"/> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"/> | ||
<title>CodeSmile AssetDatabase: CodeSmile Packages - Getting Started</title> | ||
<link href="tabs.css" rel="stylesheet" type="text/css"/> | ||
<script type="text/javascript" src="jquery.js"></script> | ||
<script type="text/javascript" src="dynsections.js"></script> | ||
<script type="text/javascript" src="clipboard.js"></script> | ||
<link href="navtree.css" rel="stylesheet" type="text/css"/> | ||
<script type="text/javascript" src="resize.js"></script> | ||
<script type="text/javascript" src="navtreedata.js"></script> | ||
<script type="text/javascript" src="navtree.js"></script> | ||
<script type="text/javascript" src="cookie.js"></script> | ||
<link href="search/search.css" rel="stylesheet" type="text/css"/> | ||
<script type="text/javascript" src="search/searchdata.js"></script> | ||
<script type="text/javascript" src="search/search.js"></script> | ||
<script type="text/javascript" src="darkmode_toggle.js"></script> | ||
<link href="doxygen.css" rel="stylesheet" type="text/css" /> | ||
<link href="custom.css" rel="stylesheet" type="text/css"/> | ||
</head> | ||
<body> | ||
<div id="top"><!-- do not remove this div, it is closed by doxygen! --> | ||
<div id="titlearea"> | ||
<table cellspacing="0" cellpadding="0"> | ||
<tbody> | ||
<tr id="projectrow"> | ||
<td id="projectlogo"><img alt="Logo" src="steffen portrait codesmile logo larger top-left-64x62.png"/></td> | ||
<td id="projectalign"> | ||
<div id="projectname">CodeSmile AssetDatabase<span id="projectnumber"> 1.8</span> | ||
</div> | ||
<div id="projectbrief">Clean and accessible version of Unity's ~20 year old AssetDatabase.</div> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
</div> | ||
<!-- end header part --> | ||
<!-- Generated by Doxygen 1.10.0 --> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
var searchBox = new SearchBox("searchBox", "search/",'.html'); | ||
/* @license-end */ | ||
</script> | ||
<script type="text/javascript" src="menudata.js"></script> | ||
<script type="text/javascript" src="menu.js"></script> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
$(function() { | ||
initMenu('',true,false,'search.php','Search'); | ||
$(function() { init_search(); }); | ||
}); | ||
/* @license-end */ | ||
</script> | ||
<div id="main-nav"></div> | ||
</div><!-- top --> | ||
<div id="side-nav" class="ui-resizable side-nav-resizable"> | ||
<div id="nav-tree"> | ||
<div id="nav-tree-contents"> | ||
<div id="nav-sync" class="sync"></div> | ||
</div> | ||
</div> | ||
<div id="splitbar" style="-moz-user-select:none;" | ||
class="ui-resizable-handle"> | ||
</div> | ||
</div> | ||
<script type="text/javascript"> | ||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */ | ||
$(function(){initNavTree('md__p_1_2de_8codesmile_8assetdatabase_2_g_e_t_t_i_n_g_01_s_t_a_r_t_e_d.html',''); initResizable(); }); | ||
/* @license-end */ | ||
</script> | ||
<div id="doc-content"> | ||
<!-- window showing the filter options --> | ||
<div id="MSearchSelectWindow" | ||
onmouseover="return searchBox.OnSearchSelectShow()" | ||
onmouseout="return searchBox.OnSearchSelectHide()" | ||
onkeydown="return searchBox.OnSearchSelectKey(event)"> | ||
</div> | ||
|
||
<!-- iframe showing the search results (closed by default) --> | ||
<div id="MSearchResultsWindow"> | ||
<div id="MSearchResults"> | ||
<div class="SRPage"> | ||
<div id="SRIndex"> | ||
<div id="SRResults"></div> | ||
<div class="SRStatus" id="Loading">Loading...</div> | ||
<div class="SRStatus" id="Searching">Searching...</div> | ||
<div class="SRStatus" id="NoMatches">No Matches</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
||
<div><div class="header"> | ||
<div class="headertitle"><div class="title">CodeSmile Packages - Getting Started</div></div> | ||
</div><!--header--> | ||
<div class="contents"> | ||
<div class="textblock"><p><a class="anchor" id="codesmile-packages---getting-started"></a> Orientation mainly for Asset Store customers since there is nothing under 'Assets' after installation because everything is in 'proper' npm packages.</p> | ||
<p>Check the Menu for available functionality:</p><ul> | ||
<li>Window => CodeSmile => ..</li> | ||
</ul> | ||
<p>Run the Tests to confirm that everything is alright:</p><ul> | ||
<li>Window => General => Test Runner -> (EditMode) -> select CodeSmile* -> (Run Selected)</li> | ||
</ul> | ||
<p>Locate the Packages (README, scripts, etc):</p><ul> | ||
<li>Project view: <code>Packages/CodeSmile *</code></li> | ||
<li>File system: <code><path-to-project>/Packages/de.codesmile.*</code> </li> | ||
</ul> | ||
</div></div><!-- contents --> | ||
</div><!-- PageDoc --> | ||
</div><!-- doc-content --> | ||
<!-- start footer part --> | ||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> | ||
<ul> | ||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0 </li> | ||
</ul> | ||
</div> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.