Getting Started
Adding Your Commands
Jahro allows you to customize your Unity development process by executing specific commands whenever you need them. Let's delve into how you can set this up:
Understanding Command Execution
Jahro uses a reflection to find and execute methods marked with a specific attribute. These methods can be tied to a specific object, a callback, or be independent of any object (static).
Naming, Description, and Grouping Your Commands
When naming your commands, be sure to avoid using spaces—we use spacing to separate values and names. Plus, you can structure your commands in Visual Mode by assigning a group name. Don't forget to provide a concise description of your commands—it'll make future-you grateful!
[JahroCommand("MyCommand", "This is a simple command", "MyGroup")]
To use JahroAttribute, include the using JahroConsole; namespace.
Executing Static Methods
Want to execute static methods? Simply add the [JahroCommand] attribute to those methods. Here's an example:
[JahroCommand("MyCommand", "This is a simple command", "MyGroup")]
public static void MyCommand()
{
Debug.Log("MyCommand has been executed.");
}
Executing Non-Static Methods
For non-static methods, Jahro provides several options to register and execute them:
Option 1: Object Registration Method
This option involves associating the method with a specific object. To do this, mark your non-static method with a Jahro attribute and register the corresponding object with Jahro.RegisterObject(object). This gives Jahro the object context it needs to execute specific methods.
// Mark the method with JahroCommand attribute
[JahroCommand("my-command")]
private void MyNonStaticMethod()
{
// Your method's logic here
}
// Later in your code
Jahro.RegisterObject(this); // 'this' refers to the object that contains MyNonStaticMethod
Option 2: Command Callback Registration
Another method is to use Jahro.RegisterCommand to register a command callback.
For example:
// Registering command callback
Jahro.RegisterCommand<float>("my-command", "My command description",
(myParameter) =>
{
// Your command's logic here
});
Option 3: Registration by Method Name
Lastly, you can register a method by its name using the Jahro.RegisterCommand("method-name", object, "SomeMethod")
format.
Remember, the power of Jahro lies in its flexibility and the multitude of options it offers. Feel free to explore these techniques and choose the one that suits your project's needs the best!
Adding Variables to Watch
Jahro gives you the power to observe your project in real-time. You can watch the current values for fields and properties—whether they're primitives, arrays, vectors, or components.
Naming, Describing, and Grouping Your Variables
When you add variables to watch, consider the following:
Naming: Assign a unique name to each variable. Description: Write a concise, clear description for each variable. This will provide insight into what each variable represents and why it's being watched. Group Name: For easy access and organization, assign a group name to your variable
Marking Variables for Observation
Let's look at how to mark variables for observation:
1. Static Fields and Properties
To monitor a static field or property, simply add an attribute to it. Here's an example:
[JahroWatch("VarName", "A static variable to watch.", "Group1")]
public static int staticVarToWatch;
2. Non-static Fields and Properties
For non-static variables, you need to mark these fields and properties with an attribute and register the object with Jahro.RegisterObject(object). Here's how:
[JahroWatch("VarName", "A non-static variable to watch.", "Group2")]
public float nonStaticVarToWatch;
// Later in your code
Jahro.RegisterObject(this);
With these steps, you'll have a comprehensive view of your real-time project state, proving invaluable for debugging and fine-tuning your Unity project.
Console Execution
Launching Jahro is a breeze, with a range of execution methods at your disposal:
Keyboard Shortcut: Open Jahro using a keyboard shortcut. Don't like the default? Change it in the settings to suit your style.
Open Button: Prefer a button? You can enable a Jahro open button in the settings.
Mobile Execution: On mobile? A simple triple-tap at the screen's top brings up the console.
API Access: Want full control? Use the Jahro API to customize how the console shows or hides.
Choose the way that works for you, and take control of your Unity project with Jahro!
Executing Commands
Here's how you can execute commands with Jahro:
Text Mode: Type your command in the input field. Need to add parameters? Just include them after a space. Our autocomplete feature will assist you in finding the command.
Visual Mode: Not a fan of text input on mobile? No worries! Our Visual mode lets you see, group, and even mark your favorite commands.
Viewing Output: See the results of your commands right away in text mode. If a command returns a string, it's displayed instantly.
Watching Variables
With Jahro's Watch mode, you'll always be informed about your variables' state in real-time. Here's what it offers:
Wide Range of Data Types: From strings, integers, and floats, to complex structures like arrays and vectors—Jahro has got you covered.
Detailed Insights: Explore individual variables for in-depth understanding. Mark crucial ones as favorites for quick access.
Real-Time Updates: Values are refreshed during each Unity Update cycle, so you always have the most current data.
Accessing Logs
With Jahro, you won't miss a detail. It captures all Debug.Logs from your project and presents them in your build. This way, you can see what's happening in real-time, even while your project is running. Just remember, if you've disabled Logs in your Unity settings, they won't appear in Jahro.
Disabling Jahro from the Build
If you need to exclude Jahro from your build, it's straightforward. Just switch off the "Enable" toggle in Jahro settings. This action keeps all of Jahro's functionalities in your codebase but deactivates them, meaning they won't affect your project. No need to worry about removing API calls or Jahro attributes.
Send us your feedback
We value your ideas! Your feedback plays a crucial role in shaping Jahro's features. So, don't hesitate to share your thoughts. With your help, we can make Jahro more efficient and more attuned to your needs. Let's build a better Jahro together!