コード例 #1
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            ScriptLoaderByJson loader = (ScriptLoaderByJson)target;
            var comps = loader.gameObject.GetComponents <Component>();

            foreach (var comp in comps)
            {
                var compType = comp.GetType();
                if (compType == typeof(ScriptLoaderByJson) || compType.Assembly.GetName().Name == "UnityEngine")
                {
                    continue;
                }

                if (GUILayout.Button("Gen Json To" + compType.Name))
                {
                    GetComponentInfomation(loader, compType);
                    loader.srcObj = JsonObject.NewInstance(comp).ToJson();
                }
            }
        }
コード例 #2
0
 private void GetComponentInfomation(ScriptLoaderByJson scrLoader, System.Type compType)
 {
     scrLoader.assemblyName  = compType.Assembly.GetName().Name;
     scrLoader.componentName = compType.FullName;
 }