Reputation: 21
Unity version : 2020.2.3
I am working on a Evo Pop style game where I have to scale up the cubes at runtime. I am developing a basic prototype of it, I found that even with single cube on terrain, it hits huge spikes if I scale up the cube at runtime.
It generates GC of 0.6kb every frame until the cube is growing (scaling up). Also the Physics.Processing takes around 87%
How to optimize the physics collision when your colliders are scaling up & down at runtime?
Screenshot : rigidbody settings
Upvotes: 1
Views: 1312
Reputation: 338
I would recommend using Tween
from Surge Package(Free)
using UnityEngine;
using PixelPlacement;
void ScaleMyBlock(float ScaleOffset)
{
Tween.LocalScale (transform, initialScale , Vector3.one * ScaleOffset, 1, 0, Tween.linear, Tween.LoopType.None, null, null);
}
You can read more about it here.
Upvotes: 1