1 //variables that declare different modifiers in a script2 intNUM1;3 Private intnum2;4 protected intnum3;5 Public intnum4;6 Public intNUM5 = -;//The common type, which is displayed in the panel, is the NUM5 is serialized, saved up7 8[Serializefield]//customizable Extenders for private NUM6 serialization9 Private intNUM6 =Ten;Ten One A[Hideininspector]//let the shared variables not show - Public intNUM7 =Ten;
- The default modifier is privateandnum1 is not displayed
- Private modifier variables are not displayed on the panel
- Protected modified variables are not displayed on the panel num3
- the public modified variables are displayed on the panel, the variables are serialized, and the num4 will display the corresponding type default value 0
- The public modifier type variable is assigned a value that displays the corresponding assignment NUM5
- [Serializefield] : Yes, you can not Inspect the variables displayed in the panel are displayed
- [Hidlelnspecter]: can be displayed in the Inspect Panel, has been serialized variables hidden
serialization: When reading again The variables that are serialized in Unity are valued and do not need to be assigned again because it has been saved. The next time you read, it is the value of your last assignment. That controls the attitude Property State
[Serializefield] Inherit from property Attitude , forcing Unity serializes a private (a private property can be serialized in Inspector display in the panel)
[Hidlelnspecter] makes a variable not appear in the Inspector panel, but is serialized. Will not be displayed, nor will it be called externally
Small white _unity Engine _ variable