Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Tomza · Sep 19, 2013 at 12:43 PM · webplayerembedding

How to embed Web Player on Wix.com with the widget HTML iFrame/Embed?

I added in the webPlayer.html file under:

 u.initPlugin(jQuery("#unityPlayer")[0], "webPlayer.unity3d");

following line:

 unityObject.embedUnity("unityPlayer", "https://www.dropbox.com/s/xxxxxxxxxxxxxxx/webPlayer.unity3d", 640, 360);

It doesn't work. It seems easy but it doesn't load my game. I don't know why. I wish it can run on my Wix.com website.

There are UnityObject and UnityObject2. Maybe this is a problem. I should use UnityObject2. However,is there something like UnityObject2.embedUnity? Probably no. I changed the full code. I deleted the line:

  unityObject.embedUnity("unityPlayer", "https://www.dropbox.com/s/xxxxxxxxxxxxxxx/webPlayer.unity3d", 640, 360);

We should use unityObject2 only with jQuery.

Maybe it will be clearer with the full code:

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
     <head>
         <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
         <title>Unity Web Player | Zombie Soldiers from Swamps</title>
         <script type='text/javascript' src='https://ssl-webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/jquery.min.js'></script>
         <script type="text/javascript">
         <!--
         var unityObjectUrl = "http://webplayer.unity3d.com/download_webplayer-3.x/3.0/uo/UnityObject2.js";
         if (document.location.protocol == 'https:')
             unityObjectUrl = unityObjectUrl.replace("http://", "https://ssl-");
         document.write('<script type="text\/javascript" src="' + unityObjectUrl + '"><\/script>');
         -->
         </script>
         <script type="text/javascript">
         <!--
             var config = {
                 width: 1200, 
                 height: 600,
                 params: { enableDebugging:"0" }
                 
             };
             var u = new UnityObject2(config);
             
             jQuery(function() {
 
                 var $missingScreen = jQuery("#unityPlayer").find(".missing");
                 var $brokenScreen = jQuery("#unityPlayer").find(".broken");
                 $missingScreen.hide();
                 $brokenScreen.hide();
 
                 u.observeProgress(function (progress) {
                     switch(progress.pluginStatus) {
                         case "broken":
                             $brokenScreen.find("a").click(function (e) {
                                 e.stopPropagation();
                                 e.preventDefault();
                                 u.installPlugin();
                                 return false;
                             });
                             $brokenScreen.show();
                         break;
                         case "missing":
                             $missingScreen.find("a").click(function (e) {
                                 e.stopPropagation();
                                 e.preventDefault();
                                 u.installPlugin();
                                 return false;
                             });
                             $missingScreen.show();
                         break;
                         case "installed":
                             $missingScreen.remove();
                         break;
                         case "first":
                         break;
                     }
                 });
                 u.initPlugin(jQuery("#unityPlayer")[0], "https://www.dropbox.com/s/xxxxxxxxxxxxxxx/webPlayer.jpg");
             });
         -->
         </script>
         <style type="text/css">
         <!--
         body {
             font-family: Helvetica, Verdana, Arial, sans-serif;
             background-color: black;
             color: white;
             text-align: center;
         }
         a:link, a:visited {
             color: #bfbfbf;
         }
         a:active, a:hover {
             color: #bfbfbf;
         }
         p.header {
             font-size: small;
         }
         p.header span {
             font-weight: bold;
         }
         p.footer {
             font-size: x-small;
         }
         div.content {
             margin: auto;
             width: 1200px;
         }
         div.broken,
         div.missing {
             margin: auto;
             position: relative;
             top: 50%;
             width: 193px;
         }
         div.broken a,
         div.missing a {
             height: 63px;
             position: relative;
             top: -31px;
         }
         div.broken img,
         div.missing img {
             border-width: 0px;
         }
         div.broken {
             display: none;
         }
         div#unityPlayer {
             cursor: default;
             height: 600px;
             width: 1200px;
         }
         -->
         </style>
     </head>
     <body>
         <p class="header"><span>Unity Web Player | </span>Zombie Soldiers from Swamps</p>
         <div class="content">
             <div id="unityPlayer">
                 <div class="missing">
                     <a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!">
                         <img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />
                     </a>
                 </div>
             </div>
         </div>
         <p class="footer">&laquo; created with <a href="http://unity3d.com/unity/" title="Go to unity3d.com">Unity</a> &raquo;</p>
     </body>
 </html>
 






I hope it will help.

The problem is that I can't use UnityObject2. There's jQuery. Alas, I have no experience with jQuery.

I see that it's a new topic because I don't see jQuery and UnityObject2 tags. Yes, my all questions are hard to answer. I see that I will be forced to learn jQuery :). How to use it with Javascript.

The error is "Invalid Data File. Data file is corrupt.Not a Unity Web Player file." The file seems good ( I uploaded second time). And it is webPlayer.unity3d. Any ideas?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Seizure · Sep 19, 2013 at 04:46 PM

When it runs from a server it sometimes does not like the .unity3d file extension. Try changing line

 unityObject.embedUnity("unityPlayer", "https://www.dropbox.com/s/xxxxxxxxxxxxxxx/webPlayer.unity3d", 640, 360);

into this

 unityObject.embedUnity("unityPlayer", "https://www.dropbox.com/s/xxxxxxxxxxxxxxx/webPlayer.jpg", 640, 360);

and then for the actual unity3d object change its file extension to jpg, it should ask if you are sure you want to convert it, say yes.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Tomza · Sep 19, 2013 at 05:27 PM 0
Share

Thanks for your answer. You use unityObject, but it needs to use unityObject2. With jQuery. However, I tried your solution. Alas, it doesn't work :(.

avatar image
0

Answer by Tomza · Sep 19, 2013 at 06:53 PM

My Web Player works! I just changed

  u.initPlugin(jQuery("#unityPlayer")[0], "https://www.dropbox.com/s/xxxxxxxxxxxxxxx/webPlayer.unity3d");

into

  u.initPlugin(jQuery("#unityPlayer")[0], "https://dl.dropboxusercontent.com/u/xxxxxxxxxxxxxxxx/WebPlayer.unity3d");

There should be the Public folder in a DropBox account. You need create one, and then you move WebPlayer.html and WebPlayer.unity3d there. You right click on the file WebPlayer.unity3d and get the public link. And this link you can add to u.initPlugin... (the second code). Then, you can paste the full code to the widget HTML iFrame/Embed on your website on Wix.com.

Yes, it works, but really slowly. I don't know why. I'll be testing this solution.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image gottigamer · Jun 20, 2014 at 04:59 PM 0
Share

Hey there, I just read your post and was excited to try it out, but however I am still receiving error messages that it "failed to download data file". Can you help me with this situation?

avatar image renman3000 · Jan 14, 2015 at 03:47 PM 0
Share

Will this work with any cloud storage service or is Dropbox different for any reason?

avatar image Tomza · Jan 14, 2015 at 06:54 PM 0
Share

Sorry Guys,

I don't have a free time as a true coder :). This solution should work for you. Look at that:

http://tomaszzackiewicz.wix.com/lina-it-technologies#!zsfs-i-demo/c1za9

Dropbox is know for this solution, so better use Dropbox. I have never used other cloud storage services for that. $$anonymous$$aybe, you will have to apply different tricks.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Youtube videos in Unity WebGL 2020.3 0 Answers

How to remove a dotted line around the WebPlayer 4 Answers

flash preloader in unity web player 0 Answers

Embedding game on site 0 Answers

Why can't I build Web Player in Unity while I have no problems with building standalone versions? 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges