Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting instances of rope mesh renderer at runtime
#1
Hi! 
I want to constantly changle length with cursor and adjust instances amount at runtime. But every time when I change instances amount, my rope teleports to some point and becomes straight, then cursor updates it and rope teleports back and becomes normal.
Is it a bug or setup issue or anything else?
Reply
#2
Managed to fix it like this: any time I need to change instances amount, I wait till Initialization in UniTask
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.
Reply