Quantcast
Channel: Questions in topic: "loadassetatpath"
Viewing all articles
Browse latest Browse all 62

ScriptableWizard Problem with LoadAssetAtPath

$
0
0
I'm getting error messages when trying to use this bit of code in a C# editor script - ScriptableWizard. The code is from the Unity script reference for "EditorUtility.InstantiatePrefab" I'm new to scripting, especially for the editor, so not sure how to solve this. Part of my code: string localPath = "Assets/Prefabs/prefab_" + prefab.name.ToLower() + ".prefab"; line 69 if (AssetDatabase.LoadAssetAtPath( localPath, GameObject)) { if (EditorUtility.DisplayDialog("Are you sure?", "The prefab already exists. Do you want to overwrite it?", "Yes", "No")) { Debug.Log("File does exist already"); } } else { Debug.Log("File didn't exist already"); } **Errors in Unity**: Assets/Editor/CreatePrefabFromModels.cs(69,63): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected Assets/Editor/CreatePrefabFromModels.cs(69,35): error CS1502: The best overloaded method match for `UnityEditor.AssetDatabase.LoadAssetAtPath(string, System.Type)' has some invalid arguments Assets/Editor/CreatePrefabFromModels.cs(69,35): error CS1503: Argument `#2' cannot convert `object' expression to type `System.Type'

Viewing all articles
Browse latest Browse all 62

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>