How to initiate a counter when the script runs once it increments and once called, increments again?
How to initiate a counter when the script runs once it increments and once called, increments again?
using UnityEngine; using System.Collections;
public class LoadWorldMapCounter : MonoBehaviour { public static LoadWorldMapCounter Instance; public int LoadMapCount; // Use this for initialization
public void Awake()
{
DontDestroyOnLoad (this);
Instance = this;
// Not sure where to put or how to use this so that everytime this script runs it adds 1-->LoadMapCount++;
}
public void Start()
{
// Not sure where to put or how to use this so that everytime this script runs it adds 1-->LoadMapCount++;
}
}
What do mean by runs and calls? Do you want it to increment every-time a new scene is loaded? Or do you want to increment on a function call?
Your answer
Follow this Question
Related Questions
how to make an account in a game to dodge falling bombs,How to make a point counter in a game? 0 Answers
How can I destroy a GameObject after a scene is loaded? 1 Answer
Destroy object when a new scene loads 0 Answers
Attempt counter reset when click retry scene 0 Answers
Destroy object when a new scene loads 0 Answers