Hello Guest

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Rirath

Pages: [1]
1
Support / BMFont + 2D Toolkit output issues?
« on: December 30, 2013, 12:34:56 am »
Hey guys, this may arguably be more of a BMFont issue, but I'm pretty sure I followed the instructions to the letter and I was having no luck converting a TTF to work with 2D Toolkit.  I repeatedly got the error "only one page supported in font" despite only having a single page.  So for anyone else having the same problem:

In comparing the .fnt file with some demo files, the key difference appears to be that BMFont is setting chnl=15, while 2D Toolkit appears to expect chnl=0.  Changing this in a text editor (with no other changes) cleared things right up.  Any idea if I missed a setting somewhere, or has BMFont just changed something since the docs were written?

2
Support / Two Whack a Mole tutorial bugs & possible fixes (Unity 4.3)
« on: November 15, 2013, 08:06:07 am »
Hey guys, just picked up 2D Toolkit the other day - enjoying it so far.  Immediately went through the Whack a Mole tutorial and I believe I've found two bugs, and two possible fixes, in Unity 4.3.  These are in both the step by step directions, and the RestOfGame_Complete.unitypackage download.

#1 - in MainGameScript.cs

Code: [Select]
randomMole = (int)Random.Range(0, moles.Count - 1);

while(moles[randomMole].sprite.gameObject.activeSelf)
{
randomMole = (int)Random.Range(0, moles.Count - 1);
}

As is, the code appears to never select the last MoleUnit prefab in your game.  If you have 3, it will select from 2.  If you have 6, it will choose between 5. 
Changing

Code: [Select]
randomMole = (int)Random.Range(0, moles.Count - 1);
to

Code: [Select]
randomMole = (int)Random.Range(0, moles.Count);
appears to solve this issue without introducing any new ones. 
Note that (1, moles.Count) does not seem to work - it will also skip a mole and possibly introduce lockups. (see below)

#2 - Related, also in MainGameScript.cs

Code: [Select]
moleLimit = 3;
Unity will hang after running for a short period of time if the number of (selectable) MoleUnits is less than the moleLimit.  For example, 1 or 2 moles with a limit of 3.  The whole program locks up and needs to be shut down via taskmanager.  Setting the range to (0, moles.Count) and making sure the moleLimit is not greater than the number of MoleUnits you have appears to solve this.  The above range fix is important as without it, even 3 moleUnits with a moleLimit of 3 will crash due to only two being available.  I'm not entirely sure what's causing the lockup, however.

I'm a web developer by trade, very new to Unity and only a hobbyist game developer,  so while I have some idea of what's going on it's only the gist.   ;)  But I didn't see these fixes while looking around, so thought I'd post them here in the hopes someone will find this useful.

Pages: [1]