How do I prevent bugs or debug a broken project?

Don’t delete attributes that are being used.

Starting in GameSalad 0.11, you will get the warning message when you try to delete an actor attribute in use, just as you currently would if you try to delete a game attribute that is in use. If you ignore this warning, you will get an error similar to the one above and actors may stop working.

Screen Shot 2016-03-22 at 2.38.45 PM

Label Behaviors

Labeling behaviors will allow you to quickly know and remember what the behaviors do. You can and use this to label that the behavior is verified to work when trying to find issues by going between the Actor Editor and the Preview.

Screen Shot 2016-03-22 at 2.36.31 PM

Use the Log Debugging Statement

 

While previewing your game in GameSalad Creator(not on a device via the GS Viewer), you can use the Log Debugging Statement behavior to check the value of an attribute or to check if a rule was activated. The output of the behaviors are logged in the Debugger(Cmd+D) which you can find from the GameSalad drop down menus.

Screen Shot 2016-03-22 at 2.32.26 PMScreen Shot 2016-03-22 at 2.31.17 PMScreen Shot 2016-03-22 at 2.31.27 PM

Use the On/Off Toggle on Behaviors

 

The On/Off Toggle on behaviors are useful to track down issues. If something doesn’t run correctly, turning off the behavior or a group of behaviors can help you narrow down the problem.

 

Screen Shot 2016-03-22 at 2.36.47 PM

 

Save Versions

 

If a project is at a good working state, save a version of it. If it isn’t, save a version anyways but not over the working version.

Check Your Expressions

 

Errors in expressions can happen due to several issues. See below for common issues with expressions. Using the Log Debugging Statement or even a Display Text behavior to see the value of an expression can tell you if the expression is valid or not.

Screen Shot 2016-03-22 at 2.40.17 PM

 

  • Not enough parentheses. “(“or “)”
  • Not enough quotation marks around text values.
  • Not following the format for the functions and leaving out required input values.
  • Using the wrong kind of attributes. e.g. assigning a table attribute to a boolean value.
  • Mixing Boolean attributes with anything else.
  • Dividing by 0.
  • Accessing a table cell that doesn’t exist.
  • An attribute in use was deleted.(see above)

 

 

 

Try Not to Unlock Actor Instances to Edit Actors

 

Unlocking instances can get messy when creating actors. Although you can specify how an actor works if it is the only one that will ever do those actions, you can’t easily find issues that may arise with the project. Prototype actors(the actors in the list of actors) are meant to have behaviors that define actors that can be placed in multiple scenes or multiple times in a scene. Changing the prototype will change all the locked instances of that actor so you don’t need to change each instance. If there is an error in an expression in one unlocked instance, it can break other actors from running their behaviors and you would need to check each unlocked instance until you find the issue.

 

 

If All Else Fails, Hack and Slash

 

If there are just too many actors or behaviors in a scene or project to do any of the options above, you can delete actors in a scene and preview the project until it works. First, save a copy of the project in a safe place. Give it a version number or some special name so you know not to delete from that project. In the project that you don’t mind deleting actor instances, start deleting non-essential actor instances and preview the project between deletes. If the project is still broken, start deleting other actor instances and previewing until the project starts to work. The last actor deleted before the project started working again most likely had an error. Get a copy of the saved project and find the issue in that actor. Repeat from the beginning in case there were multiple actors that could have caused the problem.

Was this article helpful?

Related Articles