That is great! I hope that never changes.
I guess my point was to provide some context for anyone else finding this thread as this solution does have potential drawbacks.
- Use of global variables (even if engine provided) is a potential source of problems (not GEngine specifically, but members of it that you have no control over).
- If this were the best solution to the problem, Epic code would do this to avoid unnecessary passing of context variables. But they don’t.
- There are still circumstances where this can bite you. There is a comment on that variable that explicitly states that it could be null and that you should check it before use. So cases like unviewable processes like tools or dedicated servers that don’t need viewports probably don’t have one for you to access here.
Again, if it’s working for you that’s great. It’s not going to work for everyone and I thought it important that information was included for anyone else that comes upon this thread in the future. (of course I only saw it because of Willard necro’ing it with formatted code)