Time for action – hiding the cursor on the screen
OUYA's cursor is slightly different than other components of our game in that it's displayed and managed by an unseen Java script that we didn't need to create. This code is a core part of the OUYA SDK, so we can't change it directly; instead, we need to use methods that have been included in the SDK that serve the purpose of safely modifying core functionality.
By default, the cursor appears whenever the cursor is moved, as shown in the following screenshot:
Perform the following steps to hide the cursor on the screen:
Create a new function called
HideCursor
inCursorScript.cs
:void HideCursor() { }
Add the following line to the
HideCursor
function to call the Java function that hides the cursor graphic:void HideCursor() { OuyaSDK.OuyaJava.JavaShowCursor(false); }
Add a call to
HideCursor
in yourUpdate
function so that it's called for every frame:void Update() { HideCursor(); }
Deploy your game to the OUYA console and swipe the touchpad to...