Archive 17/01/2023.

Crash making cursor visible

rogerdv

Im trying to make the mouse cursor visible, studied the demos, but seems that I missed something.
I tried this:

Cursor* cursor = GetSubsystem<UI>()->GetCursor(); cursor->SetVisible(true);

but seems that second line is not conrrect, because it causes a segfault. Whats the correct way to make cursor visible?

cadaver

That is valid only if a cursor UI element (which is separate from the OS cursor) has actually been set by the application. You should be able to avoid the crash by nullchecking.

Controlling the OS mouse cursor visibility happens through the Input subsystem -> Input::SetMouseVisible().