Proposal: Custom PlayerLoopTiming combination
See original GitHub issueCurrently, 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:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
First, you need to provide the code.
Maybe I could implement SwitchToMainThread like JobHandle’s awaiter(register for multiple enough separated timings)with struct. Should I still use another name?