2 votes Vote

Objects and VS Pro Objects don't work with biomes

Unity 2019.3.13f1, MM 2.0.2
When trying to use Objects or VS Pro Objects node inside a biome graph, this error is produced and generation fails:
Thread failed: System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Den.Tools.Matrices.Matrix.get_Item (System.Int32 x, System.Int32 z) [0x00001] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Tools\Matrix\Matrix.cs:76
at Den.Tools.Matrices.Matrix.GetInterpolated (System.Single fx, System.Single fz) [0x00195] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Tools\Matrix\Matrix.cs:101
at Den.Tools.Matrices.MatrixWorld.GetWorldInterpolatedValue (System.Single x, System.Single z) [0x00081] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Tools\Matrix\MatrixWorld.cs:211
at MapMagic.Nodes.ObjectsGenerators.BaseObjectsOutput.SkipOnBiome (Den.Tools.Transition& trs, MapMagic.Nodes.ObjectsGenerators.BaseObjectsOutput+BiomeBlend biomeBlend, Den.Tools.Matrices.MatrixWorld biomeMask, Den.Tools.Noise random) [0x00001] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Generators\Objects\Runtime\ObjectsOut.cs:89
at MapMagic.Nodes.ObjectsGenerators.ObjectsOutput.Finalize (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00134] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Generators\Objects\Runtime\ObjectsOut.cs:206
at MapMagic.Nodes.Graph.Finalize (MapMagic.Products.TileData data, MapMagic.Products.StopToken stop) [0x00088] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Nodes\Graph.cs:805
at MapMagic.Terrains.TerrainTile.Generate (MapMagic.Nodes.Graph graph, MapMagic.Terrains.TerrainTile tile, MapMagic.Terrains.TerrainTile+DetailLevel det, MapMagic.Products.StopToken stop) [0x0007c] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Terrains\TerrainTile.cs:665
at MapMagic.Terrains.TerrainTile+c__DisplayClass38_1.b__0 () [0x00000] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Terrains\TerrainTile.cs:617
at Den.Tools.Tasks.ThreadManager.TaskThreadAction (Den.Tools.Tasks.ThreadManager+Task task) [0x00002] in C:\Dev\games\forawhile\Assets\3rdParty\MapMagic\Tools\ThreadManager\ThreadManager.cs:125
Den.Tools.Tasks.ThreadManager:TaskThreadAction(Task) (at Assets/3rdParty/MapMagic/Tools/ThreadManager/ThreadManager.cs:128)

Refeas, 12.05.2020, 22:11
Idea status: completed


Wraith, 12.05.2020, 22:40
Is there any way I can reproduce this issue? Could you please email me the graphs (mail@denispahunov.ru)?

If anybody will encounter this issue - feel free to send me the graphs too.
Refeas, 12.05.2020, 23:47
I was able to reproduce it in this simple scenario:
1. Create an empty graph, let's call it Biomes.
2. Create Biomes Set node there
3. Create second graph Biome1
4. Place Scatter and Objects/VS Pro Objects to Biome1 and connect them
5. Create third graph Biome2 - you can leave this one empty
6. Assign Biome1 as background layer to Biome Set in Bomes graph and Biome2 as another layer - you don't have to connect the second layer to anythint

When you press generate, the error appears. If you still need the graphs, let me know, but this is exactly how i reproduced it.
Wraith, 23.05.2020, 12:09
Maybe I'm missing something, but can't reproduce it this way. Could you please email me (mail@denispahunov.ru) or upload these graphs with their meta files?
Refeas, 23.05.2020, 13:31
Done, just sent you an email.
Wraith, 26.05.2020, 22:55
Thanks for sending me the graphs! I could reproduce and fix the issue.

Here is a quick fix:
for Objects: https://www.dropbox.com/s/pehrht2vy3umb8v/ObjectsOut.cs?dl=0
for VS Pro: https://www.dropbox.com/s/mgole104qf4ot9k/VSProObjectsOut.cs?dl=0

Leave a comment