Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
5
Question by Jedda · Mar 03, 2010 at 09:19 PM · loadhtmlcontent

How to load html content

Is it possible to load a web page from a Unity3d standalone build?

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image springwater · Oct 17, 2015 at 05:04 AM 0
Share

I also want to do this.. I want to build a browser in unity.. imagine being able to display a webpage on a ball..ins$$anonymous$$d of a window. animated windows that crumple like trash when u close them ect.. lasers and bombs to select links.. full control in a cool environment to build a browser.. it would detroy all other browsers in about a day.. Why is this not a standard unity template?. I want a dynamic webrowser under my control that can be its own search engine ect. and I can create my tabbed windows in Blender and script all their functions myself. i think building an operation system in unity would also be amazing.. but daunting due to file types. If anyone has the power to implement this please do so.

2 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by burnumd · Mar 03, 2010 at 10:04 PM

Unity does not have a built-in HTML parser/renderer. That said, you have a couple options.

  • If you're using Unity Pro (and building a standalone, as your question suggests), you can use the HtmlTexturePlugin to display a web page on some surface. This solution has some limitations (described in the wiki page).
  • You can always pull raw HTML content using the WWW class, and render it as best you can. AFAIK, there are no publicly available HTML renderer scripts.

So the short answer is, "Yes it's possible to load a web page; but what you do with it is another, more difficult matter."

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image William R. Cousert · Dec 14, 2010 at 12:15 AM 0
Share

The HtmlTexturePlugin is $$anonymous$$ac only. Is there anything similar to this for Windows?

avatar image burnumd · Dec 14, 2010 at 06:16 PM 0
Share

Not that I know of. I haven't looked at the HT$$anonymous$$L Texture Plugin in a while, but if I remember correctly, it used Webkit which is embeddable in OS X. So you'd have to wrap some HT$$anonymous$$L rendering engine for it to work in Windows.

avatar image yoyo · Dec 29, 2010 at 10:41 PM 0
Share

See also this thread, which mentions use of Web$$anonymous$$it and other possible techniques. http://forum.unity3d.com/threads/30677-Show-a-website-in-Unity

avatar image lodendsg · Mar 09, 2013 at 04:38 PM 0
Share

Adding a bit more to this: http://labs.awesomium.com/unity3d-integration-tutorial-part-1/

I was looking for similar feature and most of the lines I ran down called for Unity Pro which I don't yet have. The link I provided there sugests it works Basic or Pro

avatar image oakshiro · May 06, 2013 at 07:04 AM 0
Share

Sadly, awesomium doesn't seem to work anymore since they upgraded to 1.7...

Show more comments
avatar image
1

Answer by springwater · Oct 27, 2015 at 11:55 AM

Well, I started writing my own parser/3d browser, it doesn't do much yet. it gets an URL, splits it into sub blocks of text and displays them. in theory if the sub block is too long it will shorten them, if they are to short it will lengthen them. then it runs through the program to the end one time printing out (again in theory) the first fifteen lines.. its buggy and I need to drink coffee to fix it. the next step will be to identify tags/attributes within it, remove them.. put info in proper field variables and so on.. it is attached to a background image plane and needs a starting 3dtext object in the scene.( and a light and camera.) my script uses a voice synthesizer.. you can remove the associated code from it regarding that.. but it seems like I have my foot in the door. or nose in the door of this process.(maybe I'm doing it wrong... going about it in a backwards manner.. ) but I'll share it with you guys. also, the GUI in the picture is separate and nonfunctional so far.

[1]: /storage/temp/57035-htm1.png

 #pragma strict
 // this script attaches to the background plane object in truedragon unityproject..by  Aaron McCue oct 2015
 
 var url: String; 
 var www: WWW;
 var a=0;
 www = new WWW( "https://www.yahoo.com/");
 var textt:GameObject;
 var texta:String; 
 var k=0; //keeps track of how many lines were too long
 var clonedonce=false;
 var clonedtwice=false;
 var clonezactive=false; 
 var clonedzero=false;//print overflown first line of html
 var printoriginal=false;//print first line of html
 var g=0;
 
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////START FUNCTION BELOW////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 function Start() {
  WindowsVoice.theVoice.speak("Welcome to true dragon, the browser of tomorrow");
 //www =  new WWW( "file:///C://Users/dell/Desktop/dragontest.htm");
 //texta= textt.GetComponent.<TextMesh>().text;
     
 }
 
 
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 /////////===============================//UPDATE FUNCTION BELOW///================================================
 /////////////////////////////////////////////////////////////////////////////////////////////////////
 function Update(){////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 
 //-solid never changes region-------------------------------this code below should be stable and mostly unchangin-------------
 
 if (www.isDone==true&& a==0){//wait for www to load... var a prevents this from occuring more than once
 var readout=www.text ;//readout is now the string html object
 var tree : String[] = readout.Split("<"[0]);// break the original html at all <characters
 
 // var renderer: Renderer = GetComponent.<Renderer>();          //saving these for later implementation
 //renderer.material.mainTexture = www.texture;                  //saving these for later implementation
 
 
 /////////////////////////////////solid never changes region above///////////////////////////////////////
 /////////////////////////////////////no/low change above ///////////////////////////////////////////////////////
 //////////////////////////////////////////////parse lines code below////////////////////////////////////
 
 
 
 
     for (var i=0; i<=15;  i++){       // do everything in this loop 15 times (print 15 lines of html)
     if (!(i > tree.Length))
   textt.GetComponent.<TextMesh>().text= textt.GetComponent.<TextMesh>().text.Concat(tree[i]);// sets textt.text to concat [i] .but does not check to see if its too long!
 //printoriginal=true;// this doesnt do anything.. because at the end  the var a is set to 1.. stopping this from happening each time continued below
 //~cont. everything here runs once!
 //--------------------split the original string if neccesary
 
 
 
 //===============================================================tree [i]  which was broken at <  too long below========================
 if (textt.GetComponent.<TextMesh>().text.Length>60){// if the first line is too long.. break it
  var firsttree: String[]=textt.GetComponent.<TextMesh>().text.Concat(tree[i]).Split(" "[0]);//splits the first broken sting at blank spaces
 
 textt.GetComponent.<TextMesh>().text="nil";//sets text to something small so it doesnt trigger trouble for the next step
 
 //below the textt.GetComponent.<TextMesh>().text.Length is assumed to be about 1 word long on first itteration, because it was just split
 for ( var i0=0; textt.GetComponent.<TextMesh>().text.Length <= 60;  i0++){// i0 will count up each time concatenatin words as long as the str lgnth<60
 
  if (i0>=firsttree.Length){//stops the for loop from going over firsttrees[] length and will reset i0 to zero
  i0=0;//resets i0 for use in the next line
   WindowsVoice.theVoice.speak("eye, o, is greater or equal to first tree dot length property");
  break;
  } //breaks out of the loop if i0 (current itteration) is greater than
  
  
    if( clonezactive==false)//the next line should only concatenate until full.. this should solve that 
    Debug.Log("fisttreelength minus 1="+(firsttree.Length-1));
    Debug.Log("io="+i0);
     if (i0<firsttree.Length-1){//i0 should not exceed firttreelength
    textt.GetComponent.<TextMesh>().text= firsttree[i0].Concat(firsttree[i0+1]);
    clonedonce=true;//first tier line that was broken is being concatenated
   }// end (i0<=firsttree.Length-1) bracket
      if (textt.GetComponent.<TextMesh>().text.Length>=60){//if/when concatenation itteration is greater than the halfed string length
      
      if( clonezactive==false)
       clonezactive=true; 
         WindowsVoice.theVoice.speak("original line, has maxed its length");
 var   clonezero =Instantiate(textt,textt.transform.position, textt.transform.rotation);// creates a clone for the next line after line 1
     clonedzero=true;
     clonezero.GetComponent.<TextMesh>().text=firsttree[i0].Concat(firsttree[i0+1]);
 
    } //if/when concatenation itteration is greater than the halfed string length end bracket
   }//for i0 loop bracket
   
   
    }//end original text too long
    //=======================================first line of < broken text was ok as far as length is concerned======================================================================
    else//textt.text not greater than 60!!  first line was not too long.. need to concat
   { for (var j=0;textt.GetComponent.<TextMesh>().text.Length<60;j++)//try to concatenate too make a complete line
   
    if (j>20) 
    break;
    
   textt.GetComponent.<TextMesh>().text=textt.GetComponent.<TextMesh>().text.Concat(tree[g]);
   if (g<tree.Length)
   g++;
   else
   break;
   //--------------this next area shoud make a short text longerbut not longer than 60 chars
    if (textt.GetComponent.<TextMesh>().text.Length>60){
    Debug.Log("textt.text just passed 60 its at "+textt.GetComponent.<TextMesh>().text.Length + ".. removing lastword");
    var line1:String= textt.GetComponent.<TextMesh>().text;
   var index= line1.LastIndexOf(" \\b\\s*");// removes the word on the right ans any righthand blankspace to the edge i think!to shortena line thats gone over
    line1.Replace(line1.Substring(index),"");
    
   var  textty:String[] = textt.GetComponent.<TextMesh>().text.Split(" "[0]); 
   Debug.Log("The last word in textt.text was: " + textty[textty.Length - 2] ); 
  // for( var o = 0; o < textty.Length - 1; o++) 
  //Debug.Log(textty[o] + " " ); 
   //i0--; <----- something must be done to account for bites eaten here from the begging of the readout, readout neads to be recalculated i suppose. 
  Debug.Log("textt.text now sits at "+textt.GetComponent.<TextMesh>().text.Length);
   g=0;
    break;
    }
    
    }
    //========================================================================================================================
    
  var    clone =Instantiate(textt,textt.transform.position, textt.transform.rotation);// creates a clone for the next line after line 1
  //-------------------------------------------------------------------------------------------------------------------
  //-----------------------primary string full and breaks
    if (clone.GetComponent.<TextMesh>().text.Length>60){//if the clone is too long we split it
      WindowsVoice.theVoice.speak("line"+i+ "was too long" );
      k++;//keeps track of how many lines were too long
      
      clonedonce=true;// this sends a message to print the output to line a line when the 15x loop is done with an itteration
    var tree2 : String[] = clone.GetComponent.<TextMesh>().text.Split(" "[0]);//tree2 is the new split array
    
   // var clone2=Instantiate (textt,textt.transform.position, textt.transform.rotation);//instanciate a clone2 that have up to 30 char
    
    // clone2.transform.position.y-=.2+i*.5;//position clone2 for concatenation
     var i2=0;
      clone.GetComponent.<TextMesh>().text=tree2[i2];
      
     for ( i2=0; clone.GetComponent.<TextMesh>().text.Length < 60;i2++){
        if (i2>clone.GetComponent.<TextMesh>().text.Length){
        WindowsVoice.theVoice.speak("clone, too, has maxed its length");
    break;
 }//end if i2 greater than clone length bracket 
     //clone2.GetComponent.<TextMesh>().text=tree2[i2].Concat(tree2[i2+1]);
      clone.GetComponent.<TextMesh>().text=tree2[i2].Concat(tree2[i2+1]);
  //-----------------------------------------------------------------------------------------------------------    
     if(i2==60){//first substring broke and is overflowing
     i2=0;//reset i2 for next primarystring
      clonedonce=false;//stops the message from the first clone from getting printed
     clonedtwice=true;//starts the message from the  clone for getting printed
     var tree3 : String[] = clone.GetComponent.<TextMesh>().text.Split(" "[0]);
     var clone3=Instantiate (textt,textt.transform.position, textt.transform.rotation);//instanciate a clone2 that have up to 30 char
    
     //clone3.transform.position.y-=.2+i*.5;//position clone3 for concatenation
     
         for (var i3=0;clone3.GetComponent.<TextMesh>().text.Length<60;i3++){
           if (i3==clone3.GetComponent.<TextMesh>().text.Length)
    break;
     clone3.GetComponent.<TextMesh>().text=tree3[i3].Concat(tree3[i3+1]);
   
       if(i3==60)
     i3=0;
     
     }//end fo i3=0 loop
     }//end first substring broke bracket
     }  //for i2=0 bracket
     Destroy(clone);
     }//end first clone too long bracket
    
    
    /////////////////////////////////////////////////////////////parse lines code above////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     // if( printoriginal==true){//none of this was needed because the oeriginal runs once and always prints itself then a is set to one below stopping other itterations
     // printoriginal=false; 
     // i++;//one of the 15 iterations goes up 
     // textt.GetComponent.<TextMesh>().text;
     //  }   
     //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
     ////////////////////////////////////////////////////////////////////////////printlines code below///////////////////////////////////
     
       if( clonedzero==true){
        clonezactive=false; 
     i++;//counts as a second line
     clonezero.transform.position.y-=.2+i*.5;
     clonezero.GetComponent.<TextMesh>().text=firsttree[i0];
   clonedzero=false;
   }    
  
  if( clonedtwice==false)
     clone.transform.position.y-=.2+i*.5;
    if( clonedonce==false)
     clone.GetComponent.<TextMesh>().text=tree[i];
     
     if( clonedonce==true){
     clone.GetComponent.<TextMesh>().text=tree[i2];
   clonedonce=false;
   }    
   
     if( clonedtwice==true){
     i++;//counts as a second line
     clone3.transform.position.y-=.2+i*.5;
     clone3.GetComponent.<TextMesh>().text=tree[i3];
   clonedtwice=false;
   }    
   
     //Debug.Log(tree[i]);
     //if (i==20)
     //if (i==readout.Length-1)
     
     }//end i<15 bracket
   
 a=1;
   WindowsVoice.theVoice.speak("A, equals one, vaariable eye, has, surpassed fifteen,  program complete");
 }//end isdone bracket
 
 }//end update


htm1.png (376.5 kB)
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Alternative to WWW Loading 2 Answers

Images added to the Resource folder should reflect in thee build? 0 Answers

Saving and loading data from file 0 Answers

how to load random level but one? 3 Answers

WaitForSeconds 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges