Jump to content

Topic on Project:Support desk

Include Unity3D (JavaScript)

11
78.94.190.223 (talkcontribs)

Hi. I want to include the following source into a site of my MediaWiki:


<script type="text/javascript" src="http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js"></script>

<script type="text/javascript">

function GetUnity() {

if (typeof unityObject != "undefined") {

return unityObject.getObjectById("unityPlayer");

}

return null;

}

if (typeof unityObject != "undefined") {

unityObject.embedUnity("unityPlayer", "http://startrek-is.com/wp-content/themes/startrek/unity3d/FED_Steamrunner.unity3d", 640, 400);

}

</script>


How can i get it?

This will look like this: http://lcars.66th-fleet.de/include/schiffe/media_st_is1.php

JTGarrett (talkcontribs)

This Question is from me^^ JTGarrett 13:01, 9 July 2011 (UTC)

Krinkle (talkcontribs)

Go to MediaWiki:Common.js on your wiki. Assuming you have MediaWiki 1.17.0 installed, paste the following:

$.getScript('http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject.js', function(){

 function GetUnity() {
  if (typeof unityObject !== "undefined") {
   return unityObject.getObjectById("unityPlayer");
  }
  return null;
 }

 if (typeof unityObject !== "undefined") {
  unityObject.embedUnity(
   "unityPlayer",
   "http://startrek-is.com/wp-content/themes/startrek/unity3d/FED_Steamrunner.unity3d",
   640,
   400
  );
 }

});

Then create Template:UnityPlayer:

<div id="unityPlayer"></div>

Then place {{UnityPlayer}} on any wiki page, save the page, and the player should show up.

JTGarrett (talkcontribs)
Krinkle (talkcontribs)

Look at this diff. It seems there was a syntax error, should be good if you update your MediaWiki:Common.js

JTGarrett (talkcontribs)

One Post over yours i wrote:

Hi. Thanks for your help. But thats not working... did i do anything wrong?
http://stis.sci-wiki.de/index.php/Diskussion:Hauptseite
There is nothing.
And: There will be more ships. Not only the Steamrunner-Class. How can i include more then one script and include it into a wiki?
Krinkle (talkcontribs)
JTGarrett (talkcontribs)

No change. It don't work.

JTGarrett (talkcontribs)

Hope that anyone can help me...

I don't yet find a solution.

MfG

JTGarrett (talkcontribs)

omfg... okay? Now it is working... but how can i include it like a blank script... i don't know how to say it in english...

example:

I insert

{{unityGalaxy}}

and in the script and in line 11 the line

"http://startrek-is.com/wp-content/themes/startrek/unity3d/FED_Steamrunner.unity3d",

will changed in

"http://startrek-is.com/wp-content/themes/startrek/unity3d/FED_Galaxy.unity3d",

{{unitySteamrunner}}

and the line will be

"http://startrek-is.com/wp-content/themes/startrek/unity3d/FED_Steamrunner.unity3d",

or similar

JTGarrett (talkcontribs)
Reply to "Include Unity3D (JavaScript)"