Notifications
Article
DebugController Pro use tutorial
Published 2 months ago
37
0
Summary
The core function of "DebugController Pro" is the "Scene" module.In the "Scene" module, we can monitor all the game objects in the scene, as well as monitor, add, modify, delete any component on the game object.
Of course, the most exciting feature is that you can customize his debug UI for any component.Whether it is a component of the system or a custom component that inherits from Monobehaver.

Scene

Where is the Scene module?
Open the demo scene,and run,Click on the "Scene" tab in the top left corner.

Component

We can view the components on each game object at runtime.
You can change any of the component's properties as long as you implement the debug GUI for this component.
This may happen with some newly created components:No Debugger GUI!
Now you need to customize the debug GUI for them.
  1. Create a new C# script;
  2. Inherit it to class "Debugger";
  3. Mark a Attribute "CustomDebugger" in the C# class, with parameters of "typeof (your component)";
  4. Override the "OnDebuggerGUI" function, where the GUI controls are written, and these controls will be displayed in the Scene interface at runtime when this component is selected;
Sample Code:
using HT.DEBUG; using UnityEngine; [CustomDebugger(typeof(Hero))] public class DebugHero : Debugger { private Hero hero; public override void OnInit() { hero = Target as Hero; } public override void OnDebuggerGUI() { //You can customize anything here. GUILayout.BeginHorizontal(); if (GUILayout.Button("Kill")) { hero.Death(); } if (GUILayout.Button("Rebirth")) { hero.Rebirth(); } GUILayout.EndHorizontal(); GUILayout.Label("Helth: " + hero.helthValue); hero.helthValue = (int)GUILayout.HorizontalSlider(hero.helthValue, 0, hero.maxhelthValue); GUILayout.Label("Power: " + hero.powerValue); hero.powerValue = (int)GUILayout.HorizontalSlider(hero.powerValue, 0, hero.maxpowerValue); if (GUILayout.Button("Debug Hero Name")) { Debug.Log(hero.name); } } }
GUI drawn in the OnDebuggerGUI method:
And you can also add any components at runtime.
Or delete them.
Open the debug camera, you can observe the currently selected game object 360 degrees.
Ok, let's talk about it today. If you have any questions, please ask me.
DebugController is a good choice for monitoring game objects and components at runtime.
Moreover, you need to do very little work and you can use it.

HuTao
Unity,C# - Programmer
2
Comments