Unity External Links

So it has been an amusing few days as I have watched ever tree around crack break and create a hell of a mess. If you missed the sarcasm, it was there. Try reading it again. Anyway, it has given me time to work through my board of crap I need to do. One of those was write a Unity tutorial on using external links. So here we go as we dig into how to build Unity External Links.

Why do I want Unity External Links?

Part of the reason for wanting external links in Unity is I have no idea how I am going to monetize this program. In addition, I have not the foggiest clue how to handle the instruction on how to use it. There are a bunch of unknowns but I figure there is a very big chance that the app will use the internet to save the day.

Besides, if nothing else, I will want to link to social media.

Lets see how to do it.

Bland old stuff of create Unity app and getting all the folders and such built.

Lets start with creating a unity application. Open up Unity Hub and create your application.

Create an image to act as a button.

Rename the image to a better name.

Next we need to create a folder for our scripts. In the project table right click on Assets and create a new folder.

We will call it Scripts.


Now that we have the Scripts folder, we should put a script in the directory.

This is the script that will contain the external links. So right click on the Scripts and create a new script.

Double click on the script. It will open it in Visual Studio.

Clear out the default functions. Create a navigation function and use an Application.OpenURL() function. This will allow the program to open the default browser.

After you save the script in Visual Studio, it will take some time to upload to Unity. You will see in the Inspector tab the updated script. You will also see in the lower right hand corner if it is updating.

Select the Button image you created in the Hierarchy. Make sure you select the Scripts folder in Assets. Drag the ExternalLinks script to the Inspector of the button selected in the Hierarchy.

Next we need to allow button component. Press the Add Component button and search for button in the search. Select the Button component.

So we have a button. We have a Script. Lets put them together. Click on the plus on On Click section.

Connect the script and the button by dragging from the Inspector External Links script to the On Click function’s None box, which is the object to reference.

In the drop down called No Function and hunt out the function we created, NavSPDLink.

Give it a test and you should see it open in your browsers.

Hopefully this works pretty good. I was happy to find out how this was this easy.

Leave a Reply

Your email address will not be published.