Game Development Community

GUIUtil.InitGUIScreens Problem

by Matt Huston · in Torque X 2D · 03/30/2007 (4:01 am) · 4 replies

I am attempting to create a couple GUIs for my already written TX game.

I have written them using the namespace StarterGame.UI and basically there functionality is that of a splash screen like that in TankBuster.

However, my code here doesn't work.

GUIUtil.InitGUIScreens("StarterGame.UI");

It compiles however during runtime I receive the following error.

Quote:
TargetInvocationException was unhandled

Exception has been thrown by the target of an invocation.

#1
03/30/2007 (7:34 am)
We're gonna need a whole lot more than the generic error here to be of any assistance.

Put a breakpoint on all new gui screens so as soon as it's being loaded, you can walk through and find the line that's crapping out. It's not the above line that you copied in, it's one of your GUI screens.

www.linkedin.com/img/webpromo/btn_viewmy_160x25.gif

www.mmogamedev.info/images/imgdc_ad1.gif
#2
03/30/2007 (8:44 am)
Well the odd bit about it is, I am testing this using just the GUI splash screen brought in from the TankBuster example. The only changes that were made was the namespace name change and the filename to reflect my projects splash screen.
#3
03/30/2007 (9:50 am)
Each starter kit is quite a bit different and really can't have stuff pulled directly in a lot of cases (some it can, but a lot it can't). I would suggest doing what I originally thought and putting a breakpoint on them to see where the problem lies. It might be as dumb as a missing graphic or something as that happens to me a lot. TX needs an error handling layer that gives you a lot more detail and actually breaks where the problem is and not 100 calls back ;)

www.linkedin.com/img/webpromo/btn_viewmy_160x25.gif

www.mmogamedev.info/images/imgdc_ad1.gif
#4
03/30/2007 (10:21 am)
Some things to check.

1) Make sure you are specifying the full namespace
2) Make sure your GUI's are in that namespace
3) Make sure your content GUI's are using the IGUIScreen interface

And finally, the most important
4) Make sure you are correctly creating your GUI's. Anything that could cause the constructor for that GUI to fail will cause the invocation to fail, obviously.

I had this error a few times when making TankBuster and it turns out it was something I was doing wrong in the constructor. I forget what those things are now, as it was awhile ago. Things like not assigning a Style could cause the constructor to fail.

Examine TankBuster, as it is a decent example of how to use InitGUIScreens.