- Home /
GUI.Window and Web Player
Hi all,
I have a menu script (CSharp) which runs fine when I run it from the unity editor. I have a menu system which shows up properly.
BUT when I build the project for web player, the menu is not showing up.
Does GUI.Window works in web player ???
Here is the code
if (GUI.Button(new Rect(0, 0, 50, 20), "Files"))
show = true;
if(show)
m_windowSize = GUI.Window(0, m_windowSize, ShowWindow, "");
Are there any permission for web player ??
Thanks for reading
Using GUI.Window works fine in the webplayer. What's inside your window? I guess you do something evil in there :D The button name "Files" makes me imagine that you trying to use IO access or anything that isn't supported by the security sandbox.
Can you add your "ShowWindow" callback to your question?
Answer by jahroy · Dec 17, 2011 at 01:50 AM
The fact that I see the word "Files" makes me wonder if you're using code from a library that doesn't work for web builds.
There are security limitations that prevent certain libraries and operations from being used on the web.
For example, you definitely can't write a file to a user's computer from a web player (without a bunch of ninja skills).
There are actually many restrictions related to the file system that apply.
You also can't do stuff like hide the mouse cursor or go full screen without a warning message when using a web player.
Answer by athap · Dec 17, 2011 at 02:16 AM
Thanks Bunny83 and Jahroy
I love this forum and let me bow down in front of you guys.
Yes, I am writing/uploading files to/from user/appdata/local/myproject directory.
I just left my lab so I don't have the code right now but yes I am using IO libraries
Let me ask the pundits here :
Is there a way to save / load files from webplayer ?
Any pointer on the ninja skills ?
Thanks for your quick responses !!
I believe you can save/load info using PlayerPrefs from a webplayer, but I could be wrong.
You can also use the world wide interweb to read and write data, but you'd have to use some kind of server side ninja skills. That's actually pretty easy if you know some php, perl, etc...
What exactly are you trying to do?
You have to have skills like $$anonymous$$r. $$anonymous$$iyagi to write a file to the user's computer from a browser (maybe Java, ActiveX, not sure what else).
Also, you should add non-solutions as comments rather than answers.
I am saving data about what the user is doing in the environment. Server side stuff won't be suitable for what I am trying but I guess I will dig more into the web player securities. This would be my effort to get closer to $$anonymous$$r. $$anonymous$$iyagi.
Apologies for replying as answer and not as comment.
Perhaps X$$anonymous$$L is an option... or somethng similar but custom.
$$anonymous$$aybe you could tell us a little about the data you're working with.
You could always make up a story about something similar if you're game is a secret.
There are no ninja skills. There is NO WAY except PlayerPrefs and the AssetBundle cache to store any data on the users pc. If that would be possible in any way the Unity webplayer would be A HUGE security problem. If a user have installed the webplayer you could hide the webplayer somewhere on your website and when the user views your page it gets started and noone notice it. If it has access to the Users filesystem you would have just created a trojan horse.
Usually if you host a webplayer you have a webserver (not necessary but usually). If you want to store data for a specific user you have to do this on your server.
The PlayerPrefs can store up to 1$$anonymous$$B of data on the users PC per webplayer-URL. It's not much but it depends on what you wanna do.
Well, maybe/possibly you could have a java applet running from the same web page as your Unity player and communicating with your game through javascript. Applets can write to the file system if you jump through the right hoops and the user agrees to let them.
This would be an absolutely horrible idea that I would never endorse... But it might be technically possible.
Server side stuff, PlayerPrefs, or AssetBundles would be one billion times better.