question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: Custom PlayerLoopTiming combination

See original GitHub issue

Currently, registering continuation or IPlayerLoopTiming for multiple timing is not supported. But we could do it by registering PlayerLoopRunner itself to PlayerLoopRunner,or registering ContinuationQueue to PlayerLoopRunner.

internal sealed class ContinuationQueue : IPlayerLoopItem//Mark itself as IPlayerLoopItem
{
    //...
        public bool MoveNext()
        {
            RunCore();
            return true;//Always returns true for persistent registration
        }
        static ContinuationQueue CreateMultipleTimings(params PlayerLoopTiming[] timings)
        {
            var runner = new ContinuationQueue(default/*This PlayerLoopTiming is just a dummy*/);
            foreach (var timing in timings)
            {
                PlayerLoopHelper.AddAction(timing,runner);
            }
            return runner;
        }
}
internal sealed class PlayerLoopRunner : IPlayerLoopItem//Mark itself as IPlayerLoopItem
{
    //...
        public bool MoveNext()
        {
            RunCore();
            return true;//Always returns true for persistent registration
        }
        static PlayerLoopRunner CreateMultipleTimings(params PlayerLoopTiming[] timings)
        {
            var runner = new PlayerLoopRunner(default/*This PlayerLoopTiming is just a dummy*/);
            foreach (var timing in timings)
            {
                PlayerLoopHelper.AddAction(timing,runner);
            }
            return runner;
        }
}


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
neuecccommented, Aug 31, 2020

First, you need to provide the code.

0reactions
RamType0commented, Aug 31, 2020

Maybe I could implement SwitchToMainThread like JobHandle’s awaiter(register for multiple enough separated timings)with struct. Should I still use another name?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cysharp/UniTask: Provides an efficient allocation ...
Provides an efficient allocation free async/await integration for Unity. Struct based UniTask<T> and custom AsyncMethodBuilder to achieve zero allocation ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found