- Home /
webpage with a webplayer
Hello,
i have unity project with only prefeb of a Cube, build as webplayer streaming.
i would like to put this webplayer in a web page using visual studio 2010, asp.net.
so i open a new asp.net project, open a new webform. i copy the code from the webplayer(the page unity built) to my webform.
now when i run this page it contains the webplayer.
i wanna add a button and a textbox, when the user click on the btn the textbox changes its text.
input type="text" name = "text1" value="hoello" id="123"/>
input type="button" name="button10"
value="yaron" onclick=Anyoutput() />
script type="text/javascript" language="javascript">
function SaySomethingToUnity() {
document.getElementById("123").value = "pls let it change me";
} script>
but when i put this on the page with a webplayer, nothing happens for some reason, as if javascript events are disabled. any ideas on whats the problem?
Best Regards
Ron
Answer by homeros · Jun 03, 2011 at 11:35 AM
You don't need an asp.net page to accomplish what you're trying to do, an .html page is enough if you're not gonna do something server side. Anyway your problem is that you're using
onclick=Anyoutput()
but your javasript function is named
SaySomethingToUnity()
Change either of them and it'll probably work, if there isn't any syntax mistake.
thanks for your help, as i stated above, its only the first step im trying to make inorder to communicate with unity. i want it in javascript so that i can access later the sendmessage method.
it has all the examples for you
lol thats the part that im trying to implement but i cant get it to work.
Answer by BerggreenDK · Jun 03, 2011 at 11:30 AM
not sure if this is Unity3D related or more a Visual Studio problem?
If you make a new Webform within VS2010, you get a FORM element in the HTML. Drag a button and a textfield onto your page and let VS2010 do the coding for that.
Then doubleclick the button in the editor and this will open up the script/event part behind the button.
Now you are ready to code C# in ASP.net
But is your problem that you want to build a HTML item that communicates with the Unity3D player or are you trying to build some kinda login to your Unity project?
yes yes i want to communicate with the unity 3d player.
i want my c# code to run some code within unity. so the above was only the first step. and it failed..... do u have any advice, links or anything that can help me to achive this?
Thanks Ron
Still not sure of what you are trying to do. Can you explain the idea ins$$anonymous$$d of the problem perhaps? is it webbrowser/HT$$anonymous$$L talks into Unityplayer or is it Unityplayer talking to webbrowser/HT$$anonymous$$L ?
What is the goal?
Your answer
![](https://koobas.hobune.stream/wayback/20220612094640im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers
Problem with mouse cursor disappearing in webplayer 0 Answers
admob in webplayer? 1 Answer
How to load lightmap in the webplayer 0 Answers
Chrome Web Store , Google Wallet InApp Payment (JWT ??) 1 Answer