Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

unity-wave-function-collapse

unity procedural level generation with the Wave Function Collapse algorithms · By selfsame

Simple Tiled WFC "T" not working (Error)

A topic by Bamboy created May 21, 2017 Views: 745 Replies: 3
Viewing posts 1 to 4

Whenever I try to use a prefab with T, I get an error about a key not found in the dictionary:

KeyNotFoundException: The given key was not present in the dictionary.
System.Collections.Generic.Dictionary`2[System.String,System.Int32].get_Item (System.String key) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:150)
SimpleTiledModel..ctor (System.String name, System.String subsetName, Int32 width, Int32 height, Boolean periodic) (at Assets/unity-wave-function-collapse/impl/SimpleTiledModel.cs:157)
SimpleTiledWFC.Generate () (at Assets/unity-wave-function-collapse/SimpleTiledWFC.cs:89)

From what I can tell, every other tile setting works. (But it has taken a lot of trial and error so far)

Also am I correct in understanding that it should be including "empty" spaces as its own tile? It has not been doing this for me.

Upon further investigation, I have concluded that this error is caused when the prefab name contains spaces.

Problematic code resides at line 152 and 153 of SimpleTiledModel.cs. Not sure I can offer a fix, the code is pretty compact. 

At the very least updating the readme.md file would be advisable for future users.

Developer

good catch, I've opened an issue and will sort it out for the next version (which should be ready in a week or so)

https://github.com/selfsame/un...

Developer

New version is up with a fix for this, thanks again :)