Search Unity

WebPlayer crashing

Discussion in 'Editor & General Support' started by DaphydTheBard, Jun 26, 2012.

  1. DaphydTheBard

    DaphydTheBard

    Joined:
    Mar 6, 2012
    Posts:
    101
    Hey Guys

    I am getting a complete freeze in the web player with the following code:

    Code (csharp):
    1. // Load an image from the website test
    2.         if (m_folderID !=   "")
    3.         {  
    4.             m_imagePath = Application.dataPath + @"/" + m_folderID + @"/" + "picture.jpg";
    5.            
    6.             request = new WWW(m_imagePath);        
    7.  
    8.             while (!request.isDone)
    9.             {}
    10.  
    11.             request.LoadImageIntoTexture(m_tex);
    12.         }
    I have validated that the image path is valid (i.e. actually points to a file I can load in my browser) but as the code here stands, it crashes the webplayer. If I comment out the while loop, then it doesn't crash, but the image never get's loaded.

    Can anyone help?

    [EDIT] Solved my own issue (again). Can't run while loops like this in the webplayer, it blocks and then crashes.

    THanks

    Dave
     
    Last edited: Jun 26, 2012