Game Development Community

Minor issue when editing GUI's due to it running ::onWake() call

by John "Mythic" Henry · in Torque 3D Professional · 11/29/2011 (10:22 am) · 3 replies

Now I'm in the middle of configuring more hack checks in my code and ran into
a minor issue when editing a GUI before it ever connects to anything:

My ::onWake() call includes the following:

function playerMenuGui::onWake()
{
/*   
   if( !$EWG::Authenticated )
   {
      clearValues();
      $Authentication::Username = "";
      $Authentication::Password = "";
      Canvas.setContent(MainMenuGui);
   }
*/   
}

Has a simple test for someone messing with variables/bypassing code..
Which if I havent Authenticated yet: $EWG::Authenticated
The editor switches back to the MainMenuGui whenever I try to Edit the PlayerMenuGui LoL
Just a minor thing to remember about the editor for new people :)

#1
11/29/2011 (1:35 pm)
I find it helpful to always have this as the first statement in an ::onWake()
if ($InGuiEditor)
      return;
#2
11/29/2011 (4:18 pm)
Seems like even after 9 years I'm always finding little handy tweaks
now and then... Thx :)
#3
11/29/2011 (4:20 pm)
That is a nice solution to the chicken or the egg problem.