static void Prefix(ref AssetCollection assetCollection)
        {
            SessionManagerStatic.CustomAssetBundle = AssetBundle.LoadFromFile(Path.Combine(Application.dataPath, "../CustomAssets/mytestbundle"));

            for (int i = 0; i < assetCollection.Models.Assets.Count; i++)
            {
                if (assetCollection.Models.Assets[i].AssetID == "workplaces/tables/bld_tinker_tier01")
                {
                    SceneDumper.Dump(assetCollection.Models.Assets[i].Data, @"E:\GC_Test.txt");
                    assetCollection.Models.Assets[i].Data =
                        SessionManagerStatic.CustomAssetBundle.LoadAsset <GameObject>("Lathe-2");



                    // Transform old = assetCollection.Models.Assets[i].Data.transform.Find("tinker_table3x1").transform;
                    // Vector3 position = old.position;
                    // Quaternion rotation = old.rotation;
                    // Vector3 scale = old.localScale;
                    //
                    // GameObject.Destroy(old.gameObject);
                    //
                    // GameObject lathe =
                    //  UnityEngine.GameObject.Instantiate<GameObject>(
                    //      SessionManagerStatic.CustomAssetBundle.LoadAsset<GameObject>("Lathe"));
                    //
                    // lathe.transform.position = position;
                    // lathe.transform.rotation = rotation;
                    // lathe.transform.localScale = scale;
                    //
                    // lathe.transform.parent = assetCollection.Models.Assets[i].Data;

                    break;
                }
            }
        }
Exemple #2
0
        void RenderInspectChildrenWindow(int id)
        {
            GUI.Label(new Rect(20, 20, 300, 20),
                      $"{_inspectedObjChildren.Count} children in {_inspectedObject.name}");

            if (GUI.Button(new Rect(20, 45, 100, 20), "Dump Object"))
            {
                const string path = @"E:/GoodCompanyDump.txt";
                SceneDumper.Dump(_inspectedObject, path);
                ModLogger.Log($"Object {_inspectedObject} dumped to {path}");
            }

            if (_inspectedObject.transform.parent)
            {
                if (GUI.Button(new Rect(130, 45, 100, 20), "View parent"))
                {
                    SelectInspectObject(_inspectedObject.transform.parent.gameObject);
                }
            }

            const float Y_OFFSET = 20.0f;

            inspectChildrenScrollPos = GUI.BeginScrollView(new Rect(10, 70, 280, 450), inspectChildrenScrollPos,
                                                           new Rect(0, 0, 260, _inspectedObjChildren.Count * Y_OFFSET));
            for (int i = 0; i < _inspectedObjChildren.Count; i++)
            {
                float yPos = i * Y_OFFSET;

                if (GUI.Button(new Rect(0, yPos, 20, 20), "+"))
                {
                    SelectInspectObject(_inspectedObjChildren[i].gameObject);
                }

                if (GUI.Button(new Rect(25, yPos, 20, 20), "x"))
                {
                    GameObject.Destroy(_inspectedObjChildren[i].gameObject);
                    SelectInspectObject(_inspectedObject);
                }

                GUI.Label(new Rect(50, yPos, 300, 20), _inspectedObjChildren[i].gameObject.name);
            }

            GUI.EndScrollView(true);

            GUI.DragWindow();
        }