SHOW:
|
|
- or go back to the newest paste.
| 1 | public class Main : MonoBehaviour { | |
| 2 | ||
| 3 | //some public and private variables... | |
| 4 | private OtherClass OtherGameLogic = new OtherClass(this); | |
| 5 | ||
| 6 | void Start () { | |
| 7 | //some initialisation happening | |
| 8 | } | |
| 9 | ||
| 10 | void Update () { | |
| 11 | // all complex frame to frame calculations are done here. | |
| 12 | // this is gpu and cpu intensive code... | |
| 13 | } | |
| 14 | } | |
| 15 | ||
| 16 | public class OtherClass | |
| 17 | { | |
| 18 | ||
| 19 | private Main M; | |
| 20 | ||
| 21 | public OtherClass(Main m) | |
| 22 | { | |
| 23 | M = m; | |
| 24 | } | |
| 25 | ||
| 26 | private void SomeMethod() | |
| 27 | { | |
| 28 | m.SomeFunctionThatNeedsMToRun(); | |
| 29 | } | |
| 30 | } |