Search Unity

WebGL to Wordpress

Discussion in 'Web' started by Twist-Games, May 18, 2020.

  1. Twist-Games

    Twist-Games

    Joined:
    Jan 23, 2020
    Posts:
    7
    Hey, i'm new to websites & webgl. I just made my game in Unity & i then i've been trying to figure out how to get my game working in wordpress. I have been trying for pretty long now & i still have no idea at all.
    So first off, i can't figure out were i put my code from the game & socend of, i cant even find the code...
     
  2. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    Use itch io. It's free and they have solved all the server permission issues (CORS). Easy to embed a game in your wordpress as an iframe (there is an itch logo back to your itch page).
    Using itch to host your webgl projects is similar to using youtube to host videos – of course you can host large videos yourself in all compatible formats, but there's a free service that does the complicated part (and yt is way more problematic than itch, imho)
     
    NMJ_GD and Twist-Games like this.
  3. Twist-Games

    Twist-Games

    Joined:
    Jan 23, 2020
    Posts:
    7
    How about acces. Is there some way i can make it private, so you can only acces the game, through the embed version?
     
  4. Twist-Games

    Twist-Games

    Joined:
    Jan 23, 2020
    Posts:
    7
    w
    But i dont htink its pssobile to play a game on itch.io through the browser?
     
  5. wetcircuit

    wetcircuit

    Joined:
    Jul 17, 2012
    Posts:
    1,409
    WebGL is on the browser. I have several.

    similar to yt, your project can be "unlisted" on itch, and "hidden" on your landing page. There is a small itch io logo when you embed on your site (I decided I can live with it).

    They solve a lot of the cryptic internet problems, and they allow some re-styling of the host pages (which are part of your iframe embed)…. More important you can upload your WebGL build as-is (just zip the folder), set the permissions to "Playable in Browser", and it works.

    I tried for a month to get my webGL builds to show on my own WP when uploaded to my webhost. I never got that working, and I've been running several WP sites for years so not exactly a newbie.

    The issue is called CORS – a search for "Unity WebGL CORS" will take you down a rabbit hole of what the server permissions are doing. Good luck, whatever you decide.
     
    Twist-Games likes this.
  6. iMancha

    iMancha

    Joined:
    Sep 22, 2014
    Posts:
    25
    <iframe id="" src="http://domain.com/foldername/build" name="" width="1280" height="720" frameborder="0" marginheight="0" scrolling="no"></iframe>

    Upload your WebGL build to a folder under public_html via FTP, and use the above iframe snippet on any page you want to show that build.

    Also change the width and height to match your default canvas resolution in player settings -> resolution and presentation settings.
     
  7. tomasi1215

    tomasi1215

    Joined:
    Aug 26, 2020
    Posts:
    1
    that's quite possible
     
  8. PeterNashRw8

    PeterNashRw8

    Joined:
    Aug 26, 2020
    Posts:
    1
    thank you for your replies
     
  9. brandonholt95

    brandonholt95

    Joined:
    Feb 12, 2020
    Posts:
    14

    This is easily the best answer haha. Thank you!!
     
    Roman_Keivan likes this.
  10. AnalogKestrel

    AnalogKestrel

    Joined:
    Nov 3, 2017
    Posts:
    3
    Another useful thing to add, you can use Github pages as the host domain for your iframe, and so have a lot of control over it, and no itch.io logo.

    (Not meaning to further answer a solved question, but as this thread comes up on google a lot.)
     
    Roman_Keivan, DryreL and SSharpe like this.
  11. AlbertCallejo

    AlbertCallejo

    Joined:
    Jan 2, 2021
    Posts:
    1
    Yes IFRAME solution is pretty simple ( that's great!!)
    But I'm loosing the footer with fullscreen button... .. have someone here a solution?
    Thks!
     
  12. Roman_Keivan

    Roman_Keivan

    Joined:
    May 31, 2019
    Posts:
    22
    Could you provide a step by step roadmap on how to do this, thank you in advance
     
    FlyAmanita2 likes this.
  13. angiemon

    angiemon

    Joined:
    Mar 26, 2018
    Posts:
    37
    Hi! Kind of a late reply but... you think this is possible with Elementor?? :) Thanks! <3

    Hi guys!
    So I used this iFrame generator that I found really helpful:
    https://www.iframe-generator.com/
    (there's also a preview button to check the result)

    I then embedded the generated code into an HTML Widget/Block (it's in Elementor Basic, no Pro needed) and that worked pretty well!

    However, Fullscreen Button sadly missing.. if anyone knows a solution to that I would be grateful! Can this maybe be added inside Unity?

    (it's for work, so I don't want any itch.io or whatever logos in there, it's hosted from an FTP server)
     
    Last edited: Sep 19, 2023