Search Unity

UnityDog - Wordpress Plugin

Discussion in 'Made With Unity' started by Deleted User, May 15, 2013.

  1. Deleted User

    Deleted User

    Guest

    Hey guys, I made a unity plugin for Wordpress. You can see it in use here:

    http://garry.tv/2013/05/12/unity-wordpress-plugin/

    The plugin page is here (but you're best off searching for it in the plugin section of your dashboard and installing it that way)

    http://wordpress.org/extend/plugins/unitydog/

    It's a simple plugin, but has these features:

    • Upload unity3d files just like pictures
    • Embed those unity3d files just like pictures
    • Edit the stylesheet to suit your blog/site
    • Renames unity3d files so you don't have to configure your server to download them
    • Player features a 'full browser' zoom in button
    • Stops playing webplayers before playing
    • Doesn't download the unity3d file unless play is pressed

    Let me know if this is useful to you. I mainly made it for our company's internal blog - because we're doing a lot of experimentation and it's an easy way to show stuff off. If you have any requests, or it doesn't work for you - please let me know too.
     
  2. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    I am not a Wordpress user but curious to give it a try....

    There are a lot of platform like Pinterest or Thumblr they do not have plugin integration for Unity yet...
    If by chance you give it a look please send to me a PM ^__^!
     
  3. AgOkami

    AgOkami

    Joined:
    Feb 24, 2013
    Posts:
    2
    Really really grateful for this! Had some very strange issues with the old plug-in.

    But one thing I'm wondering about: I had understood that the size will automaticly be the same as how I built it, but no matter which size I use, the width seems to be correct while the height is always around 100.
    I checked the script for the plug-in, but if there's anything there I can change, I'm afraid I don't understand enough scripting to find it.
    It does work perfectly fine in full screen though.
     
  4. DougMcFarlane

    DougMcFarlane

    Joined:
    Apr 25, 2009
    Posts:
    197
    Neat, not a Wordpress user either, but thinking of creating a site to display some Unity projects.
    I see that the clickable play area is just black with a white play arrow.
    Could this be changed to optionally display a specified screenshot of the game?
    (With the play arrow overlapping too perhaps)
     
  5. kaz2057

    kaz2057

    Joined:
    Jan 18, 2011
    Posts:
    326
    Dear garry,

    I take a look at your plugin.

    But it not possibile use simple shortcode to upload unity files?
    I see that height Value is set to 300 in css file :)

    Cheers
     
  6. AgOkami

    AgOkami

    Joined:
    Feb 24, 2013
    Posts:
    2
    Thanks a lot for the tip! I'll check it out =D
     
  7. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Downloaded and will give it a try. I'm still using the old Wordpress plugin that HiggyB wrote (4 years ago but still seems to work OK).
     
  8. scarpelius

    scarpelius

    Joined:
    Aug 19, 2007
    Posts:
    966
    I doubt he can do something. Wordpress is a free downloadable software package, you can install it on your server, while pinterest and thumblr are closed source software, meaning you dont have access to the code of the website. They might expose some api to use content from their site, but that api cannot be used to create plugins like in wordpress.
     
  9. pailhead

    pailhead

    Joined:
    Oct 8, 2012
    Posts:
    68
    Is there a way to have this start at full screen on load? I've been trying to wrap my head around it but can't. I tried modifying the .js but i messed it up. And can't figure out how to tell wp to go to a specific html file :(
     
  10. pailhead

    pailhead

    Joined:
    Oct 8, 2012
    Posts:
    68
    surprisngly, i was able to pull it off by modifying the .js file,

    onload, it goes to full window, still keeping the portfolio template underneath, works fine for me



    I cant figure out how to get the player download button there, is it supposed to be there?
     
    Last edited: Jul 4, 2013
  11. Richgizmo

    Richgizmo

    Joined:
    Jan 9, 2013
    Posts:
    6
    Hi Pailhead

    I'm looking to use this plugin on a clients wordpress site. Ive got it to work so far but I cant seem to adjust the size of the unity window.
    Do you know how I can change the size of the unity frame?
     
  12. Richgizmo

    Richgizmo

    Joined:
    Jan 9, 2013
    Posts:
    6
    Ok I was able to change the size easily in the CSS file.

    Separate problem is I don't get anything asking for the plugin if you don't have the plugin installed?
     
  13. pailhead

    pailhead

    Joined:
    Oct 8, 2012
    Posts:
    68
    Yeah i've been trying to figure it out for the past couple of hours but i know very little about it :(
     
  14. stefmen

    stefmen

    Joined:
    Apr 14, 2009
    Posts:
    791
    Just installed it on my portfolio and it works like a charm!

    One problem i can't upload files bigger than 8mb do you have a workaround for that?
     
  15. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Might be an issue with your WordPress settings, I had a similar problem with large video files on my WP site. I found a solution by googling for "wordpress file size issue".
     
  16. stefmen

    stefmen

    Joined:
    Apr 14, 2009
    Posts:
    791
    Thanks that solved everything.
     
  17. pailhead

    pailhead

    Joined:
    Oct 8, 2012
    Posts:
    68
    Do you have an example of something you've posted? Without the player download option, i'm not sure if it's very useful
     
  18. retox

    retox

    Joined:
    Sep 12, 2012
    Posts:
    29
    Great plugin.

    Has anyone had any issues with the Context Menu showing up?
     
  19. PhobicGunner

    PhobicGunner

    Joined:
    Jun 28, 2011
    Posts:
    1,813
    Works great, but thought I'd like to mention this screwed up my RSS feeds. and the fix is pretty simple....

    There's a space at the beginning of the unitydog.php file, right before the PHP tag. This inserts a space into your RSS feed, thus rendering your feed invalid. Just get rid of the space and it works... ooh PHP/Wordpress can be so brittle sometimes
     
  20. DMTSource

    DMTSource

    Joined:
    Jul 11, 2013
    Posts:
    36
    Is it possible to add support to remove the fullscreen buttons, and disable the context(rightclick) unity menu? I was able to remove the fullscreen controls but not able to disable the context menu without making the play button also unfunctional.
     
    Last edited: Jul 26, 2013
  21. MaxRoetzler

    MaxRoetzler

    Joined:
    Jan 3, 2010
    Posts:
    136
    You can disable the context menu in your player build options. I don't have it here right now, but there should be 3 presets, white background, black background, no context menu.
     
  22. RegisB

    RegisB

    Joined:
    May 14, 2013
    Posts:
    41
    Yeah that's usefull thanks !
     
  23. Mr-Knieves

    Mr-Knieves

    Joined:
    Mar 7, 2013
    Posts:
    41
    Awesome work! It would nice to have height/width parameters inside [unity src="7"], but it works wonderfully!
     
  24. makoto_snkw

    makoto_snkw

    Joined:
    Aug 14, 2013
    Posts:
    340
    It's your server PHP file upload limit.
    Set in yout server through cPanel to allow up to 64Mb.
     
  25. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Any documentation at all for this? I wasn't able to get it to work initially (fresh WP 3.6 install, got errors saying the media wasn't available) but after a couple of tries it started working. Only thing I did different was to include the webplayer's HTML file with the webplayer file in the media folder. WP isn't using the HTML file but for some reason it made it work.

    Nice plugin though. Easier to use but not as flexible as the one HiggyB posted (many years old but still works).
     
  26. dreamlarp

    dreamlarp

    Joined:
    Apr 22, 2011
    Posts:
    854
    Installing this through WP there is usually a link to a tutorial or website. Yours does not have this. Do you have a link to tutorial on how to set this up and use it?
     
  27. TakuanDaikon

    TakuanDaikon

    Joined:
    Jun 6, 2010
    Posts:
    268
    I've been using this on my site for a while now, and I absolutely love it. I don't recall having any issues installing it but I never could get custom sizes to work without modifying the css file. Even so I think it's great and I love the ability to switch between embedded and full screen mode.
     
  28. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    Not sure why, but I still have intermittent problems with this plugin but not the original plugin by HiggyB. Here's a great tutorial (using the older plugin) that should help anyone who needs help.
     
    Last edited: Aug 23, 2013
  29. Madock

    Madock

    Joined:
    Aug 7, 2013
    Posts:
    5
    Hi !

    First of all, thank for this wonderful plugin, it works like a charm !

    But i'm missing something. We are doing a project that targets every little and big company, and you know how it can be a bit tricky for people who aren't familiar with that kind of application like unity, to install it and make it work. ( i mean.. My parents still didn't figure it out to scan a piece of paper with their own printer for 5 years, and the old generation are for the most confused with navigation on internet. No feelings against them by the way ).

    So my question is.. After I deactivate the webplayer, all I have is a black screen when I click on play. I would like to insert the "Unity install now" button like the one in the html file when you build your webplayer.

    I think the way to do it is just to insert the html code from unity's html page to the one from wordpress who calls the media.. But i don't know exactly where to look for..
    Or unitydog.js in plugin folder needs to be edited, since it has html code for display the webplayer. But that time I'm the one confused with javascript code :D.

    Anyone know how to do that ?


    Oh and.. I'm using a theme (I don't know if that's relevant) but the plugin is on top of one little thing and it shouldn't. My logo in my fixed header. (half the logo is exceeding from the header) I know it's just a css matter, but I tried using z-index but it didn't solve the problem. I don't know where to look for next ?
     
    Last edited: Aug 22, 2013
  30. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    how do I change the splash screen with this plugin, I have unity pro.
     
  31. lliviu

    lliviu

    Joined:
    Aug 3, 2013
    Posts:
    7
    I love this plugin.
    The functionality for the missing/broken player is rather important thou.

    So I've implemented something so that when you click on the play icon it will show you a message that you need to install the web player.

    Here are the steps in case you wanna do it:

    Go to the wordpress admin section -> plugins, and click edit on UnityDog.
    Select unitydog/unitydog.js

    Replace these lines:

    Code (csharp):
    1.                 case "broken":
    2.                     console.log( "Unity Player broken!" );
    3.                     return;
    4.                     break;
    5.                 case "missing":
    6.                     console.log( "Unity Player missing!" );
    7.                     return;
    8.                     break;
    (lines 48 - 55)

    with these lines:

    Code (csharp):
    1.                 case "broken":
    2.                     var missing_content = "";
    3.                     missing_content += "<div align='center'> \n";
    4.                     missing_content += "  Your Unity Web Player is broken,";
    5.                     missing_content += "  please use the link below to reinstall it, and then restart your browser:<br /><br />\n";
    6.                     missing_content += '<div class="broken">';
    7.                     missing_content += '<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now! Restart your browser after install." target="_blank">';
    8.                     missing_content += '<img alt="Unity Web Player. Install now! Restart your browser after install." src="http://webplayer.unity3d.com/installation/getunityrestart.png" width="193" height="63" />';
    9.                     missing_content += '</a>';
    10.                     missing_content += '</div>';
    11.                     missing_content += "</div> \n";
    12.                     jQuery('.unitydog').css("background-color", "white").css("height", "130px").html(missing_content);
    13.                     return;
    14.                     break;
    15.                 case "missing":
    16.                     var missing_content = "";
    17.                     missing_content += "<div align='center'> \n";
    18.                     missing_content += "  This content requires the Unity Web Player,";
    19.                     missing_content += "  please use the link below to install the player, and then refresh this page:<br /><br />\n";
    20.                     missing_content += '<div class="missing">';
    21.                     missing_content += '<a href="http://unity3d.com/webplayer/" title="Unity Web Player. Install now!" target="_blank">';
    22.                     missing_content += '<img alt="Unity Web Player. Install now!" src="http://webplayer.unity3d.com/installation/getunity.png" width="193" height="63" />';
    23.                     missing_content += '</a>';
    24.                     missing_content += '</div>';
    25.                     missing_content += "</div> \n";
    26.                     jQuery('.unitydog').css("background-color", "white").css("height", "130px").html(missing_content);
    27.                     return;
    28.                     break;
     
  32. Madock

    Madock

    Joined:
    Aug 7, 2013
    Posts:
    5
    Thank you very very much lliviu !

    That is exactly what I needed. Now this plugin is just perfect !
     
  33. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    35
    Hey, Since i updated unity i have been having troubles getting this to work. when i upload the unity3d file, it gets to 100% then has a http error. ive done this about 20 times and i am not sure what to do. Any help would be greatly appreciated.
     
  34. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I'm having the same problem with both WordPress plugins (HiggyB's and this one). Worked not long ago (maybe last week) but no longer works now. FWIW, my webplayers are being built with 3.5.7 pro.

    @Proportion1 - What version of WordPress are you using? I've just updated a couple of other plugins and I wonder if one of them might be causing the problem.
     
    Last edited: Sep 19, 2013
  35. nuverian

    nuverian

    Joined:
    Oct 3, 2011
    Posts:
    2,087
    Just wanted to say thanks for the plugin. Definitely going to use it in my blog (sig). Hope I don't get troubles like the ones mentioned. In any case thanks a lot :)
     
  36. bigkahuna

    bigkahuna

    Joined:
    Apr 30, 2006
    Posts:
    5,434
    I think I found the cause of the issue, at least for me. I'm using a couple of plugins to control access to media on the site and one of them appears to have prevented the player from working. Turned off all plugins except the Unity3D plugin and it worked.
     
  37. Proportion1

    Proportion1

    Joined:
    Jan 6, 2013
    Posts:
    35
    Mine worked now too, I did nothing other than goto bed and try again in the morning :S buggered if i know what went wrong. but either way its an awesome plugin.
     
  38. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    has anyone been able to change the unity splash screen?
     
  39. shutongy

    shutongy

    Joined:
    Aug 9, 2011
    Posts:
    14
    Thank you so much! This is very helpful.
    The only problem I'm having is that after going into Full Screen mode, I couldn't see the Restore icon and could never come back. Does anyone else have this problem?
     
  40. Tjandy98

    Tjandy98

    Joined:
    Sep 30, 2013
    Posts:
    4
    It's Garry!!!
     
  41. rame16

    rame16

    Joined:
    Nov 21, 2012
    Posts:
    29
    Last edited: Nov 29, 2013
  42. TheRaider

    TheRaider

    Joined:
    Dec 5, 2010
    Posts:
    2,250
    Im still stuck with this, any help would be appreciated.
     
  43. EddieChristian

    EddieChristian

    Joined:
    Oct 9, 2012
    Posts:
    725
    Are you planning to Update this for the Current version of Wordpress??
     
  44. kevinseligmann

    kevinseligmann

    Joined:
    Mar 23, 2011
    Posts:
    68
    Would it be possible for someone to upload a non-wordpress version of this plugin?
     
  45. kevinseligmann

    kevinseligmann

    Joined:
    Mar 23, 2011
    Posts:
    68
    Nevermind, I did convert it myself. If anyone wants it, just say so
     
  46. frogsbo

    frogsbo

    Joined:
    Jan 16, 2014
    Posts:
    79
    Thanks! i just tested this, It runs ok! bugs: the aspect ratio is wrong, and after 20 seconds the player goes black, but the game can be played on full screen. $u3dweb.jpg

    If you want to try this insane use of unity for online coding your own 3d formulas, it's here, just press update now. this is a mad old project used for testing a website, i think the camera orbit is on the same keys as the player, i have forgotten a key. http://frogsbo.com/2014/01/20/unity-marching-cubes-sandbox/
     
  47. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    Thanks man.
    Your plugin is awesome, very easy to change css and disable fullscreen button =).
     
  48. wktk3

    wktk3

    Joined:
    Dec 19, 2013
    Posts:
    2
    Great plugin!
    I try to disable Context Menu in PlayerSettings,but does not work.

    I have no idea PHP / java. maybe wrong code.but work this.

    unitydog/unitydog.js
    Code (csharp):
    1.  
    2.     Play : function( unityelement, webURL )
    3.     {    
    4.         var params = { disableContextMenu: true, };
    5.         var player = new UnityObject2( { params:params, width: "100%", height: "100%" } );
    6.    ~~~    
    7.     }
    8.  
     
  49. nicloay

    nicloay

    Joined:
    Jul 11, 2012
    Posts:
    540
    if someone will face a problem when browser listen mouseScroll and spacebar events instead of unity player, the reason can be in a niceScroll jquery plugin.
    To temporary disable it while unity player is active, use following code in unitydog/unitydog.js file
    just add following code to the end of Setup : function( element ){..} after element.replaceWith( unityelement ); row
    Code (csharp):
    1.  
    2. var g_NumUnityDogs = 0;
    3.  
    4. var unityDog =
    5. {
    6.     Setup : function( element )
    7.     {
    8.         .......    
    9.         element.replaceWith( unityelement );
    10.  
    11.         unityelement.mouseenter(function() {   
    12.             var niceScroll = jQuery('html').getNiceScroll()[0];
    13.             niceScroll._unbind(document, (niceScroll.detected.isopera!niceScroll.detected.isopera12)?"keypress":"keydown", niceScroll.onkeypress);
    14.             niceScroll.opt.mousescrollstep =0;
    15.         }).mouseleave(function() {
    16.             var niceScroll = jQuery('html'). getNiceScroll()[0];
    17.             niceScroll.bind(document, (niceScroll.detected.isopera!niceScroll.detected.isopera12)?"keypress":"keydown", niceScroll.onkeypress);
    18.             niceScroll.opt.mousescrollstep = 8 * 3;
    19.         });
    20.     },
    21. ....
    22.  
     
    Last edited: Mar 21, 2014
  50. Tdgs2

    Tdgs2

    Joined:
    Jan 30, 2014
    Posts:
    2
    Hello

    First of all congratulations for your plugin it is amazing!

    I have a newbie question: I am trying to change the width and the height of the Unity player. I have read in other posts , that I am supposed to change the .css file. I tried looking at the php code of your script and I found this:

    Code (csharp):
    1. function unitydog_unity( $atts )
    2. {
    3.     global $g_UnityPlayerCount;
    4.    
    5.     if ( !$atts['src'] ) return "(missing unity src)";
    6.    
    7.     $width  = "\"".$atts['w']."\"";
    8.     $height = "\"".$atts['h']."\"";
    9.    
    10.     $url = wp_get_attachment_url( $atts['src'] );
    11.     if ( !$url ) return "(missing unity attachment)";
    12.    
    13.     return '<unitydog width="'.$width.'" height="'.$height.'" src="'.$url.'"></unitydog>';
    14.    
    15. }
    So I am guessing it is the atts array I am lokoing for , however I could not find anything like that in the css file. I am doing something really wrong right?

    Regards