var expTexture : Texture;
var curExp : float;
function OnGUI()
{
GUI.DrawTexture(Rect(10, 10, 60, curExp), expTexture);
}
// So when you modify curExp your size of texture will also change
// This is for demo purpose to show it is working
function Update()
{
curExp++;
}
Personally i think your if loops should be working. The one that checks if experience is more than certain amount. My script do not have experience checking.
Well, i realized there’s a typo in my previous script and as a apology, i made a new one. I packaged it and you just import the package and put the prefab on stage to try it out. Make sure maxExp is not 0.
I would say that, to migrate to C# would be the best thing you can do. Because, although there is nothing wrong with JavaScript, it’s a LOT more simpler, in C#, to debug, as you have a lot more options open to you. And finding silly things like mis-typed variables etc won’t be an issue in C#, because it will complain about it
Nope. Not a must to learn c# if you are just learning the basics of Unity. I had no problem with js too. Just started learning C# and having no problem. I think doing things in js is more faster (the more prototypical way) and in c# is more neat. Both works around the same.