How to set Button.Interactable in javascript?

Hi, I am trying to make a button for the oculus where you have to look at it for an amount of time to trigger it. I have a canvas with a button in. I can get the Pointer Enter event to trigger the hover on the button and send the button as a parameter to a new script to do the timing.

However I simply then cannot access the interactable property in the button. It seems that ‘Button’ is not a recognised object type so I cannot cast.

I am new to unity development but am an old actionscript developer and usually manage fine with javascript but this has had me stumped for hours. If anyone can shed any light on this for me it would be greatly appreciated.

thanks in advance.


You weren’t using UI.Button in the brackets, were you? You just put “Button”.

Here, this works:

   **YourButtonGameObject**.GetComponent(UI.Button).interactable = true;

XD hope it works!! it does for me