In my 2D game I want to have a Doodad. The Doodad has multiple interactive parts and has some medium complexity logic in it. During the game, frequently there will be multiple Doodads on the screen. They all work the same, but their appearance will vary. The individual Doodads will differ both in size and rotation. However I don’t want to just scale it (rotation might be fine). Instead, when I place a Doodad in my scene, I want to specify its size, rotation, and textures (of the correct size) to use. So different Doodads will also look differently due to having different textures applied to them.
My initial thought was to make the Doodad a separate scene, but I’m a bit miffed that I can’t visually adjust the Doodad’s size and rotation. I guess I can just export some variables that will control the Doodad through a script, but I really wanted to see and work with a visible bounding box in the editor.
Not sure what Doodad is, but you could describe what you want achieve with sizing collision or just swapping textures?
Easiest options in my humble opinion is have pre-made scene and load them as needed, or you could have in one scene all options and just disable and enable them as component.
Make a doodad a scene with a tool script attached to its top node. Let the exported property setters update the nodes below or bruteforce the update every frame in _process()
Honestly, it doesn’t even matter what it is. What matters is - I want to have several copies of IT in my scene, and each copy need to be of a different size/rotation. Then I also want to customize each copy by changing some sprites (textures) inside it. This latter part I can do by an exported property and script on the root node. Collisions/physics are not needed.
Ok, for concreteness, let’s say they are cats. There’s a scene which is full of cats. Some are big, some are small, some are close, some are far, some are orange, some are black, some are on the ground, some are in a tree, some are upside down, etc. But each cat has two eyes looking at me and I need the player to click all of their eyes, and after that the tips of their tails.
When I place a cat in the scene, I want to select the particular cat image to show, plus specify how the cat is oriented, so that I know where the eyes/tails are. They will always be in the same place in the cat picture, but since the cats are rotated any which way, and since they vary in size, the Cat component needs to know the total size on order to calculate where the clickable parts are. And scaling is bad since it would blur and change line widths, etc.
But, like, does that mean I need to implement my own rendering of a bounding box in the editor and interactions with it (stretching, rotating)? The component will then have way more code for the editor than for the actual functionality it needs.