Hello there,
This just purchase 2D Toolkit and this is my first time using it. I would like make a number counter using the 2D toolkit. Usually I used a sprite atlas that I made my self for the number zero to nine and just assign the coordinates manually. Below here is the script that I alwayt used for the number sprites:
using UnityEngine;
using System.Collections;
public class TestManager : MonoBehaviour {
public int testScore; //If the testScore is increasing it will move the coordinates to the next sprites.
public GameObject score;
// Use this for initialization
void Start ()
{
}
// Update is called once per frame
void Update ()
{
if (score != null)
{
//TextSprite (score, 10, 0, 10, "fScore", testScore);
}
}
void TextSprite (GameObject spriteObject, int columSize, int colFrameStart, int totalFrame, string type, int index)
{
int fScore;
fScore = index % 10;
if (type == "fScore")
{
index = fScore;
}
index = index % columSize;
Vector2 offSet;
offSet = new Vector2 (1.0f / columSize * index, 0);
spriteObject.renderer.material.mainTextureOffset = offSet;
}
}
so now when I create a power of two from the 2D toolkit option and used my script it does not work why is that?
Thank you.