Best way to change the shape of an object at runtime

Helo guys.

I am new to unity. I want create a simple 2d game. One of the entities has to grow and shrink. This is done by merging simple shapes. A rough example in the picture below just to show what I mean.

57281-lel.png

There will be a lot of entities on the screen so the performance is very important. Is it possible to change dynamically the shape of one gameobject? If not, which of the following solutions is better:

  1. Constantly add new gameobjects (shapes) to the previous one and then remove them?

  2. Create an animation. In this case is it possible to change the animation speed at runtime so for example first it grows faster and then grows slower or shrinks? My issue is whether the change of speed will apply to the whole loop of the animation or is it possible to apply it in the middle (so that the speed of shrinking and growing is different)? I would prefer the latter to happen.

If you have any other suggestions I’d be glad to hear them.

Not exactly sure how you want this to happen, but if the objects should appear at the same place all the time you can make child objects and simply enable/disable them.

For example: the default state, the big circle is the parent object. And the smaller circles and rectangle would be their own child objects that you can enable by script when you want the object to grow, and of course the other way around.

If the player should be able to add different objects wherever they want a more advanced system would be required.

Hope this helped a bit!