0

I am making a project that observes several objects in one place.

However, I want to protect the information of those objects, and I have to access the objects of those information.

It's really ambiguous how to refer In particular, how to protect the information of game objects in objectmanager.

current representative three script


[Cameramanager.cs]
This is a script that interacts with moving the camera through mouse clicks and clicking objects.

this script access other three script This way ex)

public Gamobject ga;
ObjManager objmanager=ga.GetComponent <ObjManager>();

[objectSetMangager.cs]

Script created to save and use information of multiple Gameobjects this script is singleton

ex) Save the information of the objects that changed the texture

And this script access other three script

[objectMangager.cs]

Script that stores the most important objects that need to be protected

ex) this is implemented this way

private List Gameobject important;

public vector3 ReturnPos(int id)
{
   return important[id].transform.position;
}
  1. how to refer to the important script
  2. how to access important info?
  • What do you mean by "protect"? If you can access some property and if you want to change it from outside, then there are no way to protect it. Is that `List imporant` private? – MyBug18 Aug 26 '20 at 07:20
  • @MyBug18 yes important is private .List Important 3d model and information are not to be extracted from the client. If so, encapsulation must be strictly followed, but I do not know exactly how. – MasterJung Aug 26 '20 at 07:39
  • Encapsulation only "protects" information from a programmatic level. The private/public/protected are merely constructs that specify how the software programmer should access data of other classes. Regardless of these "access levels" these do no change how the data gets placed in the final executable. Public or private, a person who decompiles your program will see the same thing. – rodamn Aug 26 '20 at 21:44
  • @rodamn hahaha i thinked that public/ private is very important. but it is not important hahahaha – MasterJung Aug 27 '20 at 00:16
  • Here is more information on what public, private, protected really do: https://stackoverflow.com/questions/614818/in-c-what-is-the-difference-between-public-private-protected-and-having-no – rodamn Aug 27 '20 at 18:39
  • @rodamn thank you i earned that 4years ago – MasterJung Aug 27 '20 at 23:44

0 Answers0