Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Making a game - What is the advantage of the secure variables?

I have made Game in Unity , which contains lots of public and private varibles and functions. I wanted the game to be secure , so I bought Anti cheat toolkit from unity asset store https://www.assetstore.unity3d.com/en/#!/content/10395 .So my question is do i need secured private variables ? If yes, then what is the use of private variables? What advantages do they have (in security terms) ?

like image 496
sagar Avatar asked Dec 14 '22 05:12

sagar


2 Answers

do I need to secure private variables ?

No, both public and private variables have the same security defences (or rather no security defences). If an attacker can view or modify a public variable, they can view or modify a private variable.

Access modifiers are there for programmer convenience and to help with architectural decisions.

like image 123
oleksii Avatar answered Dec 16 '22 17:12

oleksii


Private and public identifiers have nothing to do with security, but rather the visibility/accessibility of a method/variable/whatever.

A private var communicates to the developer that this variable is used only by its class and should not be touched/accessed anywhere else.

A public var communicates that the variable is accessed somewhere else and the value of the variable matters to the functionality to parts of the codebase/users

like image 20
Dudemanword Avatar answered Dec 16 '22 18:12

Dudemanword