- Home /
Question is off-topic or not relevant
Angry Bots sample: best practice?
I've just been digging about in the Angry Bots sample project.
Somehow I eneded up mooching about in the scripts attached to one of the big ED-209 style mechs and I noticed a script called 'FootStepHandler.js', had a look in there and got confused...
There's a function called OnFootstep() in this script and something must be calling it, but what? I'd got no idea where to look to find out how it might be getting called.
I triend find in files in Visual Studio. No joy, but was I looking in the right place? I tried file type . in the whole project folder. Still no joy.
In the end I just started trawling through all the scripts attached to the mech, and eventually found a property called 'Footstep Signals' on a script called 'MechAnimation.js' on a sub-object in the mech's gameobject hierarchy.
Opening the hierarchy of the Footstep Signals property eventually unearthed a property of a sub-part of that property (!) called 'Action' that was called 'OnFootstep'.
A quick look at the code in the script and, yep that seemed to be what was calling the script. Seriously?
Surely this sample has already formed the basis for innumerable first forays into making games and so it should be showing best practice?
Consistent structure, organisation of assets and code, some sort of showcase for whatever might stand in for coding standards in Unity terms, or at the very least some comments explaining how on earth this scattered bunch of event driven scripts hang together to make a game?
Now whilst it is awesome that Unity affords this kind of freedom and expressivity through its data driven architecture; there must be a saner way to organise this sort of code / data / code inter-reliance?
An even if there isn't; given that the (assumed to be) 'best practice' sample project uses code that implicity relies on property values set up in other code - and also some sort of mechanism whereby the gameobject can call a function in any script attached to it - is there any reason that there isn't a search tool that allows the hierarchy and project to be searched for strings to aid in finding these sorts of code-is-data-to-code dependencies more easily?
To be honest, a sensible comment in HandleFootsteps.js would probably have made a billion% difference in how easy it was to track down.
So I guess my final question is, is Angry Bots meant to be a 'best practice' sample, and if not is ther a 'Unity Best Practices' document / showcase project somewhere?
Cheers,
Alex
This is really a discussion question that would be suitable for the forums, since it's not a specific development question that has an objective answer.
Follow this Question
Related Questions
FPS Sample Unity 2 Answers
How can I pre-load samples from an audio file to spawn objects? 1 Answer
Angry Bots doesn't open the End Sequence 0 Answers
Handling mouse input based on situation 0 Answers
Sample for card matching/memory game? 2 Answers