Question by
ByteVault · Mar 08, 2020 at 02:46 AM ·
javascriptwebglbrowserbrowser communicationprevention
WebGL & denying browser script access to game methods?
Hi, as the title stated Im trying to figure out if I can make my methods used in the game NOT accessible from browser scripts.
Senario: I have a game and my player object has a playerdata-field holding the currency of the player. I also have a method using either Public or Internal access flag called AddCurrency() which adds X amount of currency specified.
Internal void AddCurrency(double currencyToAdd) //Testing Internal to see if it helps. Result: Nope.
Now, a user could send this to the game and add however much currency he wants:
unityInstance.SendMessage('Player', 'AddCurrency', 999999); // Example
What can I do to prevent this from happening? Any access flag Im unaware off? Thanks in advance! Cheers, ~ N
Comment