If I have 6 basic polyomino shapes with colliders to match. I believe there are two ways to create these at run time.
-
Use a factory for each shape type and spawn the entire game object with the collision set correctly. So 6 factories.
-
Use a single factory then change the sprite and enable/disable the collision objects as needed to cover the shape. Since they are polyominos it shouldn’t be too hard to have a shape for each square. Then just enable and disable them accordingly based on the shape selected. As in this example. Each square is easily identified and I can toggle the collisionobject for that square on or off.
Which method is better for performance? And what happens if I need to expand the game and add more shapes? How many factories are too many factories?
Thank you.