Hey there, and welcome!
I'll quickly go over some of your questions:
- Is it actually okay, or even possible, to store the generated Objects inside a Prefab and load them when needed as a Child, or would it be better to store the data individually?
You can put them in a prefab, sure!
However, Prefabs exist to make it possible to store an object graph inside a file and load it as needed, as well as authoring scenes in the editor using "instances" of a previously created object. If you generate your objects at runtime anyway, you might as well keep them around using a reference of their root GameObject without the detour over a Prefab. As long as you don't add it to a Scene or parent it to a GameObject that is already part of a scene, they won't be part of the game.
You can also clone a GameObject hierarchy using the Clone
method, so you could instantiate as many copies of the object graph as you want.
To be clear: I'm not telling you to use one approach over the other (that's for you to decide), just want to point out that they both exist!
-where is the difference between the id, and the name? Is one of them being used internally somehow and can one of them, or even both, be null without problems?
Assuming you are talking about TilesetRenderInput
, the name is an arbitrary string that you can use to identify a tileset rendering layer as a developer. The ID identifies the layer internally and is used (the list may be extended in the future) for assigning the generated texture to a texture slot
that the material forwards to the shader that is used. Usually, you would want that to be mainTex
-can you use multiple Pixmaps(Tilesets) for a TileMap? Because it seems possible to have multiple TilesetRenderInputs inside a RenderConfig
Yep, as many as reasonably fit into a single shader. Four is a safe bet, eight should be fine too for most machines, but I wouldn't know what you would use so many layers for anyway.
-can you store MetaData for Tiles inside a TileMap? For example multiple ints that can be accessed?
Nope. We have an issue on that
on GitHub, but more concept work needs to be done on this and there are lots of other tasks that have priority right now, so my recommendation would be to roll your own workaround for now. Use the tile index to do a lookup on a custom data structure to retrieve the additional data you want to store.
-and how do you get a ContentRef of a Created Object without loading it? I had two ideas. The second one seems valid but in both cases I got the feeling im doing things twice by giving it to the ContentProvider and then creating a ContentRef.
ContentRefs are only for Resources, not for objects in general. The reason they exist is that they enable you to talk about Resources without actually loading them, or to replace / reload them at runtime without having to fix up all references. For non-Resource objects, you'd just pass around the reference and that's it.
In the special case of a Resource - like a Prefab - being generated, you should indeed use ContentRefs, like you did. The easiest way to obtain a ContentRef is by implicit casting:
Prefab foo = ...;
ContentRef<Prefab> fooRef = foo; // Done!
And that's it.
It becomes more complicated when you want references to your generated Resource to be serializable, in which case the ContentProvider plays an important role, as it provides the API to resolve a Resource by its path / special name. In that case, you would have to make sure that the generated Prefab is registered in the ContentProvider before the first ContentRef to it tries to resolve. Otherwise, you might as well not add it to the ContentProvider at all.