[Solved] How to do one draw call out of a rotating coins?

Hello,

I have coins spread out on the level. Now the coin has polygons and the coins belong to the same prefab. Now whenever I use the coin it recognizes as single draw call.

I am avoiding static batching here as the coins are rotating on Y axis.

My target here is to use as many coins as possible on the level and they have to just give one draw call. When the collider interacts with the coin they disappear and as level loads they appear.

Is it possible? Your help is appreciated.

thank you & regards,

Karsnen.

you can setup a Occlusion Area (Pro Only) to help cut the count down

Maybe you will find this link useful Why isn't dynamic batching working? - Questions & Answers - Unity Discussions

FInally I did find out a solution.

Lets say that we have numerous coins scattered around the environment and all the coins have a mesh and they rotate by themselves on Y axis.

I have two scripts.

  1. CoinManager.cs
  2. CoinReceiver.cs

I create delegate and event system. I declare it public and the event as a static on the CoinManager.cs script. For the coin to rotate, generate a Quaternion with Y angle rotating. Now delegate passes this Quaternion parameter.

On the CoinReceiver.cs, I use OnEnable and OnDisable methods to activate and deactivate receiving the events. I have a method which would HandleTheEvent(Quaternion Q), which just assigns the quaternion to this.transform.rotation.

Hence with this, I was able to achieve complete dynamic batching no matter how many coins to have or you multiply during runtime. But the downside of this method is that, the coins will all rotate at the same angle.

I wish to attach the scripts in the future, as I do not have it with me right now. I hope it helps for anyone who is looking for this answer. If not kindly buzz me.

Later.