Unable to open C:/Program Files/Unity/Editor/Data/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll: Check external application preferences.
Go to Edit>Preferences>External Tools>External Script Editor and choose Visual Studio or Monodevelop, whichever one you like more. Also you can’t open any component scripts that you haven’t written (Unity is closed-source). As far as I know, that “Edit Script” button shouldn’t be there. When I click on it, it does absolutely nothing.
Thanks. How do i setup a button then? do i just add another script with OnClick() or OnMouseDown()?
To make the button do something, you can add a function in its OnClick property.
As an example, create a new object and add this script (name the script ButtonTest):
using UnityEngine;
using System.Collections;
public class ButtonTest : MonoBehaviour
{
public void ButtonAction()
{
Debug.Log("<b>Your button works!</b>");
}
}
Then go to the button component and click the “+” in the OnClick list in the Inspector. Drag on your object and then select the public function you want to execute. In this case, it’s ButtonAction.
Thanks. Worked. I have used buttons before but a while ago. I’ve mainly been practising c# scripting as im relatively new to unity(the past week i’ve been looking up quaterions, structs, methods etc)
Based on the instructions given here, I still could not get it to work, despite multiple attempts. (Been using Unity since today).
The only way I got this to work is to add the script to the button as a component, then add the button itself as the event receiver, after which I was able to select the function from a list of functions of the button (as the script is now part of it). But this seems like an overly contrived way of doing things.
Not sure what I am doing wrong.

using UnityEngine;
using System.Collections;
public class ButtonTest : Button
{
public override void OnPointerClick(PointerEventData eventData)
{
Debug.Log(“Your button works!”);
base.OnPointerClick(eventData);
}
}
