Hi everyone i have this problem that i’m stuck in like week now …
i have opened my source code developed by unity 4.6.4 in unity 5.6.6 since the last Facebook SDK required unity 5 … and when it upgrades i get this Error …" unityeditorinternal.internaleditorutility does not contain a definition for addscriptcomponentunchecked( gameobj, script ) "
please if anyone here got an answer … and sorry for my broken english guys
Replace the Create() Method like this. It should Works. I tested this code on Unity 2018.2.8f1
private void Create ()
{
CreateScript ();
//Old Code
/*if (CanAddComponent ())
InternalEditorUtility.AddScriptComponentUnchecked (m_GameObjectToAddTo,
AssetDatabase.LoadAssetAtPath (TargetPath (), typeof (MonoScript)) as MonoScript);*/
//New Code
if (CanAddComponent()) {
// Need to use reflection to access this now (it is internal)
MethodInfo addScriptMethod =
typeof(InternalEditorUtility).GetMethod(
"AddScriptComponentUncheckedUndoable",
BindingFlags.Static | BindingFlags.NonPublic
);
addScriptMethod.Invoke(
null, new Object[] {
m_GameObjectToAddTo,
AssetDatabase.LoadAssetAtPath(TargetPath(),
typeof(MonoScript)) as MonoScript
}
);
}
//New Code End here
Close ();
GUIUtility.ExitGUI ();
}