Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[Urgent Help] How to protect webgl game codes from stealing by someone

Discussion in 'Editor & General Support' started by jamesalan, Sep 29, 2020.

  1. jamesalan

    jamesalan

    Joined:
    Mar 23, 2013
    Posts:
    8
    Hi There,

    I am frustrated with the stealing of my most of webgl game codes. Whenever I built a webgl game and upload on my website after few days some gaming sites steal my game codes and upload on their websites.

    Please help me how can I solve this issue?

    Thank you
     
  2. jukka_j

    jukka_j

    Unity Technologies

    Joined:
    May 4, 2018
    Posts:
    953
    This is a tricky topic, because there is no mathematically certain way to do this, there is always a way to hack in, as long as the game is getting downloaded to the browser.

    There are some discussions and scripts about copy protection around, e.g. searching shows topics like
    https://forum.unity.com/threads/if-i-made-a-web-browser-game-could-someone-steal-it.389390/
    https://forum.unity.com/threads/site-lock-webgl.336372/
    https://forum.unity.com/threads/how-to-stop-hackers-from-stealing-my-assets.752822/

    The bottom line with these kind of protection is that they have to rely on some amount of obfuscation and secrets to make it tedious and difficult for attackers to hack in.

    Unity does not unfortunately provide a copy protection solution like this. In fact, if Unity did, then it would likely become very widely used, and by extension, a prime target to be hacked if it was used in many games, and if it was popular, its popularity would provide attention to hackers to break it. That would result in a lot of hack scripts available that people could download to hack in into any Unity WebGL game, making the protection useless.
     
    DrViJ and adamgolden like this.
  3. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,893
    I think you need a copyright lawyer not a code obfuscator.
     
  4. altepTest

    altepTest

    Joined:
    Jul 5, 2012
    Posts:
    1,105
    if his earnings from those games where on the level where he could afford a lawyer he would not asked for ways to obfuscate the code :D

    if you are nintendo then you have some chances to fight people that steal the code. else I'm afraid is a lost cause.
     
    adamgolden likes this.
  5. Mauri

    Mauri

    Joined:
    Dec 9, 2010
    Posts:
    2,663
    One thing you could try - if that is the case - is the following:

    If those sites simply copy your HTML code and don't upload the game files onto their own server, then it's called
    Inline linking
    (hotlinking) and you can kinda prevent that via a
    .htaccess
    file.

    Below is a guide on how to do this - it's mainly used for images, but I guess it could also be used for JavaScript files:
    https://www.namecheap.com/support/k...2194/what-is-hotlinking-and-how-to-prevent-it

    Edit: You can: https://davidwalsh.name/prevent-hotlinking

    .