From 4306766012e485b6bf192e602602ac54121146a3 Mon Sep 17 00:00:00 2001 From: Binboukami Date: Sat, 8 Oct 2022 00:59:38 -0300 Subject: [PATCH 1/4] Update from obsolete Prefab methods --- .gitignore | 7 ++++++- VOXFileLoader/Scripts/VOXFileImport.cs | 5 ++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index 1f3ef99..29fd8c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ *.meta Standard Assets -Materials \ No newline at end of file +Materials +/.vs/slnx.sqlite-journal +/.vs/slnx.sqlite +/.vs/UnityVOXFileImport/FileContentIndex/read.lock +/.vs/UnityVOXFileImport/FileContentIndex/a3837b48-a2f8-4f3f-9200-cc9409dc7f75.vsidx +/.vs/UnityVOXFileImport/FileContentIndex/90c58a4e-188c-4fdc-8685-996b8a5fcc0d.vsidx diff --git a/VOXFileLoader/Scripts/VOXFileImport.cs b/VOXFileLoader/Scripts/VOXFileImport.cs index 98305f5..02312cc 100644 --- a/VOXFileLoader/Scripts/VOXFileImport.cs +++ b/VOXFileLoader/Scripts/VOXFileImport.cs @@ -570,7 +570,7 @@ public static GameObject LoadVoxelFileAsPrefab(VoxFileData voxel, string name, s gameObject = LoadVoxelFileAsGameObject(name, voxel, lodLevel); var prefabPath = path + name + ".prefab"; - var prefab = PrefabUtility.CreateEmptyPrefab(prefabPath); + var prefab = PrefabUtility.SaveAsPrefabAsset(new GameObject(), prefabPath); var prefabTextures = new Dictionary(); for (int i = 0; i < gameObject.transform.childCount; i++) @@ -601,7 +601,7 @@ public static GameObject LoadVoxelFileAsPrefab(VoxFileData voxel, string name, s } } - return PrefabUtility.ReplacePrefab(gameObject, prefab, ReplacePrefabOptions.ReplaceNameBased); + return PrefabUtility.SaveAsPrefabAssetAndConnect(gameObject, prefabPath, InteractionMode.AutomatedAction); } finally { @@ -614,7 +614,6 @@ public static GameObject LoadVoxelFileAsPrefab(string path, string outpath = "As var voxel = VoxFileImport.Load(path); return LoadVoxelFileAsPrefab(voxel, Path.GetFileNameWithoutExtension(path), outpath, lodLevel); } - #endif } } From ccba02f24c2b0e900d25375e8a4c0f13665ae564 Mon Sep 17 00:00:00 2001 From: Luiz Alex Butkeivicz Date: Sat, 8 Oct 2022 01:08:37 -0300 Subject: [PATCH 2/4] Update README.md Update bumps minimum supported Unity version to ^2018.3 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9a12022..0b878d1 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Features: Requirements: ======== -* Unity 2017.2.0 or higher +* Unity 2018.3.0 or higher Contact: ------------ @@ -54,4 +54,4 @@ Contact: References: -------- -* Meshing in a Minecraft Game \[[link](https://0fps.net/2012/07/07/meshing-minecraft-part-2/)\] \ No newline at end of file +* Meshing in a Minecraft Game \[[link](https://0fps.net/2012/07/07/meshing-minecraft-part-2/)\] From 81a6e45dcf499adfb707ff9e1d057b5b2275e0bf Mon Sep 17 00:00:00 2001 From: Binboukami Date: Sat, 8 Oct 2022 02:57:06 -0300 Subject: [PATCH 3/4] update .gitignore --- .gitignore | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 29fd8c5..a0ebe79 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,4 @@ *.meta Standard Assets Materials -/.vs/slnx.sqlite-journal -/.vs/slnx.sqlite -/.vs/UnityVOXFileImport/FileContentIndex/read.lock -/.vs/UnityVOXFileImport/FileContentIndex/a3837b48-a2f8-4f3f-9200-cc9409dc7f75.vsidx -/.vs/UnityVOXFileImport/FileContentIndex/90c58a4e-188c-4fdc-8685-996b8a5fcc0d.vsidx +.vs From f485671aecdfb6426a9a3e1a1fee508d7abf3ea4 Mon Sep 17 00:00:00 2001 From: Binboukami Date: Sat, 8 Oct 2022 03:08:05 -0300 Subject: [PATCH 4/4] fix destroy of gameObj after prefab creation --- VOXFileLoader/Scripts/VOXFileImport.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/VOXFileLoader/Scripts/VOXFileImport.cs b/VOXFileLoader/Scripts/VOXFileImport.cs index 02312cc..1c2d370 100644 --- a/VOXFileLoader/Scripts/VOXFileImport.cs +++ b/VOXFileLoader/Scripts/VOXFileImport.cs @@ -570,7 +570,7 @@ public static GameObject LoadVoxelFileAsPrefab(VoxFileData voxel, string name, s gameObject = LoadVoxelFileAsGameObject(name, voxel, lodLevel); var prefabPath = path + name + ".prefab"; - var prefab = PrefabUtility.SaveAsPrefabAsset(new GameObject(), prefabPath); + var prefab = PrefabUtility.SaveAsPrefabAsset(gameObject, prefabPath); var prefabTextures = new Dictionary(); for (int i = 0; i < gameObject.transform.childCount; i++) @@ -601,7 +601,7 @@ public static GameObject LoadVoxelFileAsPrefab(VoxFileData voxel, string name, s } } - return PrefabUtility.SaveAsPrefabAssetAndConnect(gameObject, prefabPath, InteractionMode.AutomatedAction); + return PrefabUtility.SaveAsPrefabAsset(gameObject, prefabPath); } finally {