private async void OnGUI() { if (GUILayout.Button("Save")) { canvas.SetActive(true); await ZSerialize.SaveScene(); canvas.SetActive(false); return; } if (GUILayout.Button("Load")) { canvas.SetActive(true); await ZSerialize.LoadScene(); canvas.SetActive(false); return; } if (GUILayout.Button("Destroy Player")) { Destroy(ballMover.gameObject); } if (ballMover && ballMover.rb) { GUILayout.Label("Velocity: " + ballMover.rb.velocity); } }
// public override void OnPostLoad() // { // ballMover = FindObjectOfType<BallMover>(); // } private void Start() { ballMover = FindObjectOfType <BallMover>(); ZSerialize.LoadScene(); }