Skip to main content


Showing posts from 2015

Slide Screens like Android or Ios with Unity UI

Hi guy's, finally i got little familiar with moving new unity UI, using scripts, so here i am sharing my experience.
My new project have this requirement to show an intro screen with 5 images to be slided one after another, as people say "necessity is the mother of invention" :) though i invented nothing :D but finally i am getting use to new UI.

In this video you can see, how i am sliding screens one by one.

Here is the script.


publicclassUIManager : MonoBehaviour {

publicRectTransform[] introImages;
publicSprite[] dotSprites;


publicboolisLerping = false;

publicintpageCount = 1;
publicintdotCount = 0;
stringside = "";

voidStart () {
wide = we…

Export csv data from Unity WebGL

Hi guys ,

Here is something i want to share with you guys.
I never imagined myself coding in javascript :) but Unity WebGL have given me an opportunity to do so.

In this blog post i will show you how you can export your game data in unity WebGL.

Check the WebGL version here : link

This is how it looks like when you click on Create Csv button.

You can refer to my previous blog on Csv export here, I have used same script to create data for csv (with minor changes).
But the real meat is inside the Javascript plugin.

You can check more on WebGL Plugin here

My Plugin Code
var MyPlugin = {

CreateCsv: function(mydata,filename)

var csvData = Pointer_stringify(mydata);
var csvFileName = Pointer_stringify(filename);
var dataSplit = csvData.split(",");

var columns = new Array(dataSplit.length);

         for(var i = 0; i < columns.length; i++){

var rowSplit = dataSplit[i].spl…

How to create line graph in unity

Hi guys, previously i have shown how you can create Bar_Graph in unity, after successfully showing bar graph in unity i fell in love with graphs, so when i was asked to show data on a line graph, i got excited and came up with this solution, its almost similar to the bar graph, but this time i have made it more reliable and dynamic.

this is how my setup looks like :

I have an orthographic camera in my scene, which only renders a layer i namded "GUI". and every gameobject in the graph are in "GUI" layer.

why orthographic camera ? its because they easily adjust according to different screen resolutions, i have also used textMesh to show the numbers in graph, which again is the best option if you want to show text in 3d space.

here is a view, how the final graph looks like with data :

in the above image you can see that i am showing data for 99 turns,  but in this small space i cant show data for all the 99 turns, so what i did is i made a dynamic function which give…

Save data to custom PlayerPrefs using xml in Unity

Hello guys!

few months back i did  a project which need to save data in local, so i used PlayerPrefs but soon i realised that PlayerPrefs cant save more than 1mb of data, you can check the game here in this link .

So to cross that 1 mb barrier, i started to find a simple solution which is as flexible and as simple as unity’s default PlayerPrefs.

I choose xml to save data, my class also have functions Like SetFloat(), SetInt(), SetString(), GetFloat(), GetInt() and GetString().

You can find all the functions in PlayerPrefXml class.

To save a Int variable you just need to call
To save a String variable you just need to call
To save a Float variable you just need to call

To get a Int variable you just need to call
intx = PlayerPrefXml.Ins.GetInt("Speed");
To get a String variable you just need to…