Страницы

вторник, 6 августа 2019 г.

Unity code: assets saving and importing

When you have unsaved changes, you need this method: AssetDatabase.SaveAssets();
When you changed assets externally: AssetDatabase.ImportAsset(asset) or AssetDatabase.Refresh()
Note: both have ImportAssetOptions. Interesting ones:
  - DontDownloadFromCacheServer - helpful to trobleshoot cache server problems,
  - ForceSynchronousImport - in new versions of unity, asset import can be async. So, if your code requires all assets imported, you need to block, so use this option.