unity3d - Unity web open custom html after build -
i made custom html file unity web project. though after building project, opens default pre-made one. there way make unity open own html file instead of default one?
you're looking web player templates manual page.
in assets
folder, create folder named webplayertemplates
, , put template in there. you'll need html file. make easier, unity in html tokens can replace data project.
for example, 1 such tag %unity_web_path%
, replaced path built project file.
some tags include:
unity_web_name name of webplayer.
unity_width unity_height onscreen width , height of player in pixels.
unity_web_path local path webplayer file.
unity_unityobject_url in usual case page download unityobject2.js unity’s website (ie, offline deployment option disabled), tag provide download url.
unity_unityobject_dependencies unityobject2.js have dependencies , tag replaced needed dependencies work properly.
in every deployment i've seen, webplayer plugin is launched via javascript, instantiating unityobject2
, calling initplugin
method:
var u = new unityobject2(); u.initplugin(jquery("#unityplayer")[0], "example.unity3d");
the above assumes have div
id #unityplayer
, , example.unity3d
valid path unity build file.
in practice, though, recommend working unity's generated html files; include failsafes cases webplayer plugin isn't installed or fails load. manual page linked above has html source examples include of special tags.
unityobject2
have advanced features, also documented in manual. if game needs communicate outer web page, that possible.
Comments
Post a Comment