+1
Answered

How to invoke button in bolt

mikenspired 10 months ago • updated by Lazlo Bonin (Lead Developer) 2 weeks ago 4

C# Version:

myButton.onClick.Invoke();

Cant figure out how to do this in Bolt.

Great for inEditor Debugging when developing in Virtual Reality

Bolt Version:
Unity Version:
.NET Version:

* bump * 

Is there a solution for this?

If there is not one, I think the easiest thing to do would be to throw a script on the button that has something like this. Doing this off the top of my head so it may have some syntax error.
public void InvokeButton(){

GetComponenent<Button>().OnClick.Invoke();

}

+1

Actually, that's just now exactly what I did. I am using bolt to create an integration test. So for sanity, I just pass in the button I want invoked and presto. Perfect!

Answered

Hi Matthew,

You could add the ButtonClickedEvent to your custom types: https://docs.unity3d.com/ScriptReference/UI.Button.ButtonClickedEvent.html

Then, update/rebuild the unit options and the Invoke unit should appear.