Static Variables in Watcher Mode
Watching static variables is a breeze with Jahro. Just like with commands, all it takes is a simple JahroWatch attribute, and you're good to go!
Let's take a look at an example:
[JahroWatch("Total Score", "The total score of the game", "Game Stats")]
public static int totalScore;
In this case, totalScore
is a public static integer that holds the total score of the game. By marking it with JahroWatch attribute, its value is displayed in Watcher Mode under the Game Stats
group with the name Total Score
.
Here's another example:
[JahroWatch("Gravity", "The current gravity value in the game", "Game Settings")]
public static Vector3 gravity { get; private set; }
Here, gravity
is a public static Vector3 representing the gravity value in the game. Just like the previous example, it is marked with JahroWatch attribute and therefore is visible in Watcher Mode. It belongs to the Game Settings
group and appears as Gravity Value
.
Using JahroWatch for static variables is as straightforward as it gets. As long as the variable is static and accessible (i.e., private, public or internal), JahroWatch can watch it!