30-05-2021, 12:12 PM
Managed to fix it like this: any time I need to change instances amount, I wait till Initialization in UniTask
I tried to set instances in LateUpdate() with no luck. Anyway, I use Unitask in this project.
Code:
async UniTaskVoid SetInstances(int parts)
{
await UniTask.Yield(PlayerLoopTiming.Initialization, this.GetCancellationTokenOnDestroy());
meshRend.Instances = parts;
}
I tried to set instances in LateUpdate() with no luck. Anyway, I use Unitask in this project.