Use a button to open a web browser

Hi–I’m very new to Unity, so have spent several hours for several days searching for a solution before I asked anyone…I hate to bother people with such a simple question, but I have wasted so much time already that I have to ask: all I want to do is use a button I have created in a panel to open a webpage. Based on advice I found in this forum and by watching multitudinous tutorials, I made the button, targeted the button using the On Click list, enabled the script, which is below, and then, without clicking anything, the website opens right away (which makes sense, since I’ve used void Start…I’ve also tried void Update, which made it open a million times, void OnClick, void OnMouseDown, and about 100 other things I found in this forum). I want it to open only when the button is clicked, and finally have given up: I feel like this is a super SUPER easy thing to do, but for some reason I’m just not understanding how to make it happen. Again, I really am sorry to ask such a simple question, but could anyone help?

using UnityEngine;
using System.Collections;

public class urlbutton : MonoBehaviour
{
	void Start()
	{
		Application.OpenURL("http://fischhaus.com/");
		Debug.Log("is this working?");
	}

}

Hi,

Try this

 using UnityEngine;
 using System.Collections;
 
 public class urlbutton : MonoBehaviour
 {
     public void OpenURL()
     {
         Application.OpenURL("http://fischhaus.com/");
         Debug.Log("is this working?");
     }
 
 }

Then in your button component - find your button object and script and select this function from the pull down… make sure the function is PUBLIC.
Your button component should look something like this (of course which your object and script name)
78682-capture.jpg
Hope that helps,

Excellent! Perfect! Thank you!