本文介绍了错误CS0117:`unityeditorinternal.internaleditorutility'不包含`addscriptcomponentunchecked'的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
AssetDatabase.Refresh();
AssetDatabase.ImportAsset(path,ImportAssetOptions.ForceSynchronousImport);
var gameObj = target.gameObject;
var script = AssetDatabase.LoadAssetAtPath(path.MakeRelativePath(),typeof(MonoScript))为MonoScript;
InternalEditorUtility.AddScriptComponentUnchecked(gameObj,script);
#region延迟执行
// 声明为空值消除未初始化的变量
// 下面的lambda中的编译器错误。
EditorApplication.CallbackFunction callback = null;
我尝试了什么:
我在这段代码中没有改变任何内容。
解决方案
AssetDatabase.Refresh(); AssetDatabase.ImportAsset( path, ImportAssetOptions.ForceSynchronousImport ); var gameObj = target.gameObject; var script = AssetDatabase.LoadAssetAtPath( path.MakeRelativePath(), typeof( MonoScript ) ) as MonoScript; InternalEditorUtility.AddScriptComponentUnchecked( gameObj, script ); #region Delayed execution // Declared with null value to eliminate "uninitialized variable" // compiler error in lambda below. EditorApplication.CallbackFunction callback = null;
What I have tried:
I am not change anything in this code.
解决方案
这篇关于错误CS0117:`unityeditorinternal.internaleditorutility'不包含`addscriptcomponentunchecked'的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!