Version: 2023.2
言語: 日本語

AssetDatabase.RemoveScriptableObjectsWithMissingScript

マニュアルに切り替える
public static int RemoveScriptableObjectsWithMissingScript (string assetPath);

パラメーター

assetPath The path to the asset file to check.

戻り値

int The number of ScriptableObject-derived objects in the file which were removed.

説明

Removes any ScriptableObject instances from the given asset file which cannot be loaded because their scripts could not be found.

If you delete the script which defines a type of ScriptableObject, all instances of that ScriptableObject in your assets become unloadable. This also happens if you move or rename the script outside of Unity without also moving or renaming the script's .meta file accordingly. This method allows you to remove any such unloadable ScriptableObject instances from an asset. You can check whether there are unloadable ScriptableObject instances in your assets without removing them, by using AssetDatabase.GetScriptableObjectsWithMissingScriptCount.

Note: This function can only be used with native asset files. If you pass a non-native asset file, it will throw an exception.

You must call AssetDatabase.SaveAssets to save the changes to your asset, after using this method.

See Also: AssetDatabase.GetScriptableObjectsWithMissingScriptCount, GameObjectUtility.RemoveMonoBehavioursWithMissingScript.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961