is it possible to put a unity app in a web page and have the user interact with the app via normal HTML buttons etc?
I wish to use Unity as an alternative to flash but it will have to be HUGE so i thought about having only the dynamic part as a unity app and have the controls as normal html tags
I am under the impression that web apps are limited in size. Is this true or can you export to any size? I am looking for a visible area of 779 x 263
As to your second question you can easily change the size of your web content after publishing by simply updating the object/embed tags so that their width and height parameters use the values you prefer.
With the above in mind I’m still not sure why it would be better to have the controls in the web page as opposed to being within the content itself, but that’s up to you and your specific needs. If that’s the path you need to take then read the above and you should be all set.
My dean was supposed to get me a Unity License months ago. I think I will have to press him for it today so I can finally start using Unity. It just keeps getting better by the day…
I have a HTML index-file which has two iframes on it. One with the Unity-webplayer and another for content.
In Unity I have 8 objects, that should be clickable, and load content into its given iframe. It also disables the Mouselook-script and shows the cursor.
I have no problem loading content into its given iframe and disabling the scripts (parent.function). But I would like to have a button on the content-page, that says “Back”, and when clicked enables Unity’s Mouselook script again.
I have fiddled a bit with a javascript, but I can’t figure out the darn “link” for unity as it is in another frame.
In the future maybe you can start a new thread instead of posting at the end of another older thread. While these are related topics they’re not necessarily identical and it’s always best to start new topics in new threads. Moving on to the real issues here…
Have you verified that you can properly access the Unity content across the iframes? Specifically, does this return a valid object reference:
parent.uframe.getElementById("UnityContent")
I’m specifically worried about that in two layers, the first is verifying that parent.uframe returns the iframe in question (are you sure that other iframe is a child object of the same parent? have you given that iframe a name and an id value of “uframe”?), then secondarily once you know you’re getting the iframe correctly whether you’re properly accessing the Unity content. Once we’re down to that level I can say that the rest of your code looks like it should work just fine.
I’m not using iframes, so perhaps this won’t help you at all, but I just updated my Unity web page with some HTML controls that interact with my player (checkboxes and a select pulldown that control render quality, fps display and audio mute)
and you can do a View Source to inspect the HTML and Javascript. I suggest this because aside from the iframe issue, I’m not sure your Javascript is quite right - doesn’t SendMessage require a third argument? It took me a while to debug my setup, looking in the Mac Console for errors reported on the Unity side and the Firefox Error Console for problems in the Javascript.
My self-inflicted problems included a missing third arg in SendMessage (although it seems I didn’t need to specify it in the Unity message handlers), a wrongly-typed third arg in SendMessage (I passed a bool, which is not a supported type and seems to cause some weird problems), and just silly stuff like misspelled handler functions and incorrect access of my HTML controls and properties.
Sorry about the reply to this related topic, I just like it myself when browsing topics.
HiggyB:
Hehe, I’m absolutely NOT sure that parent.uframe.getElementById(“UnityContent”) is correct, that was my initial reason for writing here. However, the two iframes is on the same level with the same parent. ID and name is correct.
Technicat:
Does this mean I should/could have it like this:
parent.uframe.getElementById(“UnityContent”).SendMessage(“MainCamera”, “enableMouselook”, “enableMouseLock”);
I’m gonna try it anyway!