public static void ToDllScript(MenuCommand cmd) { MonoBehaviour monoBehaviour = cmd.context as MonoBehaviour; Type type = monoBehaviour.GetType(); if (type.Assembly.FullName.IndexOf("foundation") > 0) { return; } Assembly[] assemblies = ObjectFactory.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Assembly assembly = assemblies[i]; if (assembly.FullName.IndexOf("foundation") != 0) { continue; } Type t = assembly.GetType(type.FullName, false); if (t == null) { t = assembly.GetType("foundation." + type.Name, false); } if (t == null) { t = assembly.GetType("clayui." + type.Name, false); } if (t == null) { t = assembly.GetType("gameSDK." + type.Name, false); } if (t != null) { MonoBehaviour newMonoBehaviour = (MonoBehaviour)monoBehaviour.gameObject.AddComponent(t); if (newMonoBehaviour != null) { string json = JsonUtility.ToJson(monoBehaviour); JsonUtility.FromJsonOverwrite(json, newMonoBehaviour); GameObject.DestroyImmediate(monoBehaviour, true); break; } } else { Debug.Log("foundation not found class:" + type.Name); } } }