Count up timer for unity3d in minutes,seconds and milliseconds c#

I have been asked about how to make a count up timer in unity so many times, that i finally decided to share a simple script that does that, so here it goes.

this script will also format the timer to “00:00:00”

create a C# script in unity and add the following code to it:

float minutes = 0f;
float seconds = 0f;
float milliseconds = 0f;
string minutesS =””;
string secondsS = “”;
string millisecondsS = “”;

void Update(){

if(milliseconds >= 100){
if(seconds >= 59){
minutes++;
seconds = 0;
}
else if(seconds < 59){
seconds++;
}
milliseconds= 0;
}
milliseconds+= Time.deltaTime * 100;
if (minutes < 10) {
minutesS = “0” + minutes;
}
else {
minutesS = “” + minutes;
}

if (seconds < 10) {
secondsS = “0” + seconds;
}
else {
secondsS = “” + seconds;
}

if ((int)milliseconds < 10) {
millisecondsS = “0” + (int)milliseconds;
}
else {
millisecondsS = “” + (int)milliseconds;
}

Debug.Log(string.Format(“{0}:{1}:{2}”, minutesS, secondsS, millisecondsS));
}

Mesh and Object Deformers for Unity3D

watch a preview on youtube

you can get it from the unity assets store here

deformersThis is a set of deformers, created for unity3D and published on the assets store

its a set of mesh deformers:

  1. image deformer: use a black and white image as a deformer, suitable for terrains and other creative ideas, you can use an image sequence and let it deform the mesh too
  2. sine deformer: deform an object using a sine wave, it can be further adjusted with a curve
  3. Ripple deformer: deform objects with a ripple wave
  4. twist deformer: Twist objects, you can further refine with a curve.
  5. flare deformer: use it to flare up items, and use the curve to modify the flare
  6. curve shape deformer: deform meshes according to the curve in the inspector

and a set of object deformers:

  1. image object deformer: use images to manipulate the position of objects in 3d space, you can also benefit from using a sequence of images to create some cool effects.objectsimage
  2. object ripple deformer: use it to cause a ripple wave on the objectsobjectsripple
  3. object sine deformer: use it to cause the elements to move according to a sine wave, you can also modify with a curve.objectssine

3D Game Props for unity3D

Watch a preview on youtube

You can get it from the unity assets store through this link

This is a collection of 3D elements i created in the past for several different projects and games, for my university and clients.

This package includes around 185 3D elements. these elements are mostly low poly good quality 3D props that can be used in your game to give it that extra detail. some elements are grouped, which means you can easily separate them into the elements that form them and use those for animation, for example you can open up the lids on the dumpster.

Continue reading