using UnityEngine;using UnityEngine.UI;using UnityEngine.SceneManagement;
﻿using System.Collections;using System.Collections.Generic;
public class main:MonoBehaviour{
  public int counter;
  public int counter2;
  public Text textoutput0,textoutput1;
  //public void Awake(){
  //  GameObject[] ddol=GameObject.FindGameObjectsWithTag("controller");
  //  if (ddol.Length>1){Destroy(this.gameObject);}
  //  DontDestroyOnLOad(this.gameObject);}
  void Start(){
    Scene scene = SceneManager.GetActiveScene();
    counter=PlayerPrefs.GetInt("counter");
    if (scene.name=="Scene1"){
      //counter=50;
      }}
  void Update(){
    textoutput0.text=counter.ToString("F0");
    Scene scene=SceneManager.GetActiveScene();
    textoutput1.text=scene.name;
    if(counter2>=100){
      if (scene.name=="Scene1"){
        PlayerPrefs.SetInt("counter",counter);
        SceneManager.LoadScene("Scene2");
        }
      if (scene.name=="Scene2"){
        PlayerPrefs.SetInt("counter",counter);
        SceneManager.LoadScene("Scene1");
        }}
    counter+=1;
    counter2+=1;
    }}

// unity The name DontDestroyOnLoad does not exist in the current context
