How can I change the script to allow the end user to enter a URL, in the game view themselves, instead of me at the back end?

Here is the Unity script that I am using successfully to allow me add an asset bundle in the scene view at the back end:

using System;
using UnityEngine;
using System.Collections; 

class NonCachingLoadExample : MonoBehaviour 
    public string BundleURL;
    public string AssetName;

    IEnumerator Start() 
        // Download the file from the URL. It will not be saved in the Cache
        using (WWW www = new WWW(BundleURL)) 
            yield return www;

            if (www.error != null)
                throw new Exception("WWW download had an error:" + www.error);
             AssetBundle bundle = www.assetBundle;

             if (AssetName == "")

             // Unload the AssetBundles compressed contents to conserve memory

        // memory is freed from the web stream (www.Dispose() gets called implicitly)

It should look something like this:

The user should be able to enter the URL at the game screen.

  • \$\begingroup\$ I want to know what script will allow me to perform this function in unity3d. \$\endgroup\$ Commented Sep 16, 2016 at 8:20
  • \$\begingroup\$ So you want someone else to do your work for you? \$\endgroup\$
    – user35344
    Commented Sep 16, 2016 at 8:21
  • \$\begingroup\$ Please there is no need to be judgemental. My scripting knowledge is limited so I am looking for someone who can help me achive this function and i am willing to pay for their service, if this site is not ment for this type of help then i am sorry for this let me know i will remove my request. \$\endgroup\$ Commented Sep 16, 2016 at 8:28
  • \$\begingroup\$ Yeah, this site is for Questions and Answers. This is not the site for looking for people who would work for you. See the help center. \$\endgroup\$
    – user35344
    Commented Sep 16, 2016 at 8:38
  • 2
    \$\begingroup\$ Just to clarify, youve gone from asking us to create a script in order to allow you to download an external asset, to asking us how to create a simple user-input text box? \$\endgroup\$
    – Gnemlock
    Commented Sep 16, 2016 at 9:09

1 Answer 1


I'm not exactly sure what you're asking, but I'll try anyway

First of all you're gonna have to call Start when you click on the Load button, and as you can't start coroutines from the editor, you're need a wrapper that looks something like this:

public InputField URLField; //For pointing to the inputField

public void StartWrapper() //Add this to the Button's onClick field
     BundleURL = URLField.text; //get url from field

This gets the text from the InputField you've selected As long as you remember to select the InputField in the Editor!

Lastly add this to the top of the file to be able to refer to UI elements like the InputField:

 using UnityEngine.UI;

Since you already use BundleURL in you Start coroutine, no editing is necessary there.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .