Data transfer between different scenes and data transfer between different classes in the same scene

The requirements between different scenes are relatively high. Assume that the variable ab of class A under scene1 needs to be set to public static, and when class B in another scene2 refers to the variable value in A, it does not need to instantiate class A, directly A. ab is the value of abc obtained in A.

Classes in scene1:

 Use in scene2:

 

It is relatively simple to transfer data between different classes in the same scene. It is enough to set the variable cd of class C to public. When another class D is referenced, it is necessary to instantiate class C: C cinstance; when using cinstance.cd ( If you use class C reference directly, C.cd will report an error).

Guess you like

Origin blog.csdn.net/weixin_44345862/article/details/128228283