-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
To set up a scene properly to use the Developer Console, you can copy and paste the following from the
Developer-Console.unity
scene.
The Developer Console
gameObject is a UI which is responsible for:
- Displaying the Console information
- Interacting with the Console to execute commands
Meanwhile, the [Console Command Executor]
contains:
-
ConsoleCmdExecutor
which parses string inputs into their respective types -
ConsoleUI
which activates/deactivates the console with a custom key binding
The console command input uses the UI's UnityEvent
to send a string to the ConsoleCmdExecutor
, where
the string is split and each argument is parsed into their respective types. Once parsed, the arguments are
used to invoke a Relative Event or Global Event based on the number of arguments.
For example:
-
killall
is considered a Global Event since there is only 1 argument, the event name. -
heal 32606 50.0
is considered a Relative Event since there is more than one argument.
The reason behind this is that currently, as of .NET 3.5 version, the RelativeEventHandler
and GlobalEventHandler
work differently and at a minimum to execute a Relative Event you need 2 arguments:
- event name
- the ID of the gameObject to invoke the relative event
GlobalEventHandler | RelativeEventHandler |
---|---|
Uses Delegates | Uses Reflections to mimic Delegates for dynamic argument parsing |
Stores Delegates in a Dictionary | Stores string representations of methods in a Dictionary of Lists<string>
|
See the GlobalEventHandler
and RelativeEventHandler
pages in the manual/scripting API for a more detailed
explanation.