Hi guys, in regard to Logo Parc http://forum.unity3d.com/viewtopic.php?t=3321
I’d like to be able to “call” for a specific URL address to pop up when a player comes “near” a specific object.
So the script/action of calling is each time specific to each object (in this case, the banners call for the companies behind them).
I’ve looked into the WWW class, but couldn’t quite figure it out.
Would be amazing if anyone had some insight on this…
Thanks and best,
gon
Do you want to popup a new window in the browser? If so, then most of those will be blocked by any decent browser nowadays…
maybe we could load the url then as an html layer?
Something like that is coming in Unity 1.6 really soon now. Basically a full browser<->unity communication, so you can just call some javascript from Unity to show the layer, or whatever else you need.
hi Aras, thx for replying to my different questions
alright great, any idea when to expect 1.6 (matter of weeks or months?) —
Gon
they’re shooting for next week ; )
yeehaa !! super, looking forward to the new features!!! very exciting **
Gon
will it be a paid upgrade or is it free?
All Unity 1.x upgrades are free for our customers. Always have been
d.
nice!
getting a bit off topic, but what’s the skinny on 1.6 - any new features?
All you need is just a little patience! You won’t have to wait long.
“All you need is love.” OTEE-style.
“All you need is Unity 1.6” PECKINPAH-style
guys it’s out, so i will post how the html pop-ups will be using the new features asap !
cheers to all *** what a great piece of software ! !! democratising games, super **
shit, this still is too complex for me . .
let me try to summarize the strategy (if i understand it well, feel free to correct me) :
-
javascript function that loads a url into an html layer on top of the unity game layer
-
calling that js function from within the game when passing near banners
(each banner object feeds the function with a variable which is the url address to be called by the js)
If anyone knows how to help me with the unity part, I will figure out the javascript function (accepting 1 variable being the url).
thx guys, is really getting exciting.
-
in HTML, you often don’t “load some url” into a layer (I guess you can, but that can be complex). What you usually do is have some elements of a page hidden (css display style none), and use javascript to show them by setting css display style.
-
you just need to call ExternalCall or ExternalEval. In your case, it’s probably writing some script that inside Update() checks whether the player is close, and if he is close does that. Or use trigger zones on the banners, that might be easier.
By the way, I thing you can’t actually display something “on top” of Unity in the web page. Unity is a plugin that uses OpenGL, and usually browsers put html underneath plugins.
I cannot seem to find the concept of trigger zones in an exemple or in the manual… triggerzones as other geometry that has no visibility and is only there to trigger the script on entering that invisible geometry?
I suggest for now to just call for another URL in a new window first, later we can make the js function inside the html.
maybe you could lead me steps needed and what scripts needs to be on which objects (the one used for triggering and the visible one with the banner). thanks so much, gon.
In JavaScript:
function ShowURLInNewWindow(url)
{
window.open(url);
}
In Unity:
Application.ExternalCall("ShowURLInNewWindow",url);
Did you try searching for “trigger” in the script reference? (Collider.isTrigger and OnTriggerEnter should point you in the right direction.)
Create a cube, and you’ll see it has a collider. changing it to trigger by ticking the box means it doesnt function as a collider anymore, it is a trigger. Trigger zones are really useful for creating game behaviours from making a game object visible:
var Yourwordhere : GameObject;
Yourwordhere.renderer.enabled = false;
function OnTriggerEnter (){
Yourwordhere.renderer.enabled = true;
}
That one is for when your fps prefab or whatever enters the area. It pays to use tags in the inspector and set the controller you are using to “Player”
Playing a sound:
function OnTriggerExit () {
audio.Play();
}
Note that one needs an audio source dragged and dropped on to the trigger object to make it work…And it works when you LEAVE the trigger area.
Someone else may be able to give you a more appropriate example relevant to your query, or maybe this is enough to get you going
Helpful?-hopefully
AC