Is there a way to trigger functions in the unity editor similarly to the way you modify public fields?
Use case: I have a public void Shoot()
function on a bot, and for debug purposes I want to trigger shooting manually.
Is there a way to trigger functions in the unity editor similarly to the way you modify public fields?
Use case: I have a public void Shoot()
function on a bot, and for debug purposes I want to trigger shooting manually.
I am a bit late to the party, but there is a way, yout only need to add “ContextMenu”, then right click on the MonoBehaviour from the editor window while in play mode, and click on your menu option.
[ContextMenu("Shoot")]
public void Shoot()
{
Debug.Log("Shoot")
}
No, there is not. I typically just hack into my Monobehaviour scripts and hook up keyboard commands to specific methods.
void Update() {
if(Input.GetKeyDown(KeyCode.X))
Shoot();
}