I only found the commit for the changes and on “PR Checklist” the documentation is also unchecked If I recollect correctly it was roughly described in some release notes.
Hi, could you please also add something about .goc files? It seems like the environment requires to load .goc files for dynamic prototypes but I did not find anything about it in the documentation. I tried to simply rename .go file to .goc but it did not work.
Thanks.
The binary versions of Defold data files have a ‘c’ appended to their extensions, for instance .goc for a compiled .go file, .spritec for a compiled .sprite and so on. The files are in binary protobuf format and created by the build tools. As you probably understand now you can’t use a .go file and rename it .goc since it will still be in the verbose protobuf text mode format which is not supported at runtime.
So let’s say you have two factories in your game, factoryA and factoryB, and they can spawn two different game objects, /game/enemyA.go and /game/enemyB.go. Now if you want factory A to spawn enemyB instead of enemyA, you can do like this:
factory.unload("#factoryA")
factory.set_prototype("#factoryA", "/game/enemyB.goc")
local enemy_of_type_b = factory.create("#factoryA")
That means I had a wrong path to the prototype all the time. I think I was so confused by the extension that I didn’t look more thorough in other files. I often struggle with paths to everything…