<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.unity3d.com/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.unity3d.com/api.php?action=feedcontributions&amp;user=AngryAnt&amp;feedformat=atom</id>
		<title>Unify Community Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.unity3d.com/api.php?action=feedcontributions&amp;user=AngryAnt&amp;feedformat=atom"/>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Special:Contributions/AngryAnt"/>
		<updated>2013-05-20T14:16:50Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.19.1</generator>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2012-08-14T07:52:57Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Fixed Path and Behave URLs.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
These extensions, or ''plugins'', allow you to add special features to your unity projects without the hassle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
There are two kinds of plugin: those containing only .NET code and those which contain binary code.&lt;br /&gt;
&lt;br /&gt;
== .NET Plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins are simply DLLs which have been built from Mono/.NET source code. When your project is built, they are merged with the compiled Mono code from your project's scripts. This means that you can use them with a Unity Indie licence as well as with Pro and in web players.&lt;br /&gt;
&lt;br /&gt;
=== Cross-Platform Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[http://forum.unity3d.com/viewtopic.php?t=50843&amp;amp;start=0 Antares.dll] : a shareware part of the freeware [[Antares Project]]. Including '''Antares.Manager''' (Events message system), '''Antares.Async''' (asynchronous Asset Bundle loading and management classes) and some more helpers.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-and-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
*[http://www.arges-systems.com/articles/35/unitysteer-steering-components-for-unity UnitySteer] - UnitySteer contains a series of classes that help your game characters or vehicles maneuver around a scene: how to accelerate and for how long, how to turn depending on vehicle characteristics, how to act when avoiding obstacles or neighbors, how to keep a distance from other agents, or many other cases. Some of these behaviors are quite simple, but they can easily be combined to generate more complex vehicles.&lt;br /&gt;
&lt;br /&gt;
*[http://insidious.pt/#amplify Amplify] - Amplify is a Virtual Texturing extension for Unity Pro. It allows scene/level designers to use a huge amount of textures without worrying much about texture memory limits or streaming.&lt;br /&gt;
&lt;br /&gt;
*[http://code.google.com/p/libnoise-dotnet/ Libnoise dotnet] - libnoise is used to generate coherent noise, a type of smoothly-changing noise. libnoise can generate Perlin noise, ridged multifractal noise, and other types of coherent-noise. Pure c# port including Improved perlin noise, simplex perlin noise, fractal filters (ridged, heterogeneous, multi, hybrid, sum, sin), all the libnoise utilities except Terragen renderer. More stuff [http://forum.unity3d.com/threads/114239-Libnoise-dotnet?p=759730 here]&lt;br /&gt;
&lt;br /&gt;
=== Windows Only Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[http://speps.fr/xinputdotnet XInput.NET] - Add complete support for Xbox 360 Controller, all buttons, axes, trigges, buttons and vibration. API very similar to Microsoft.Xna.Framework.Input. Tested with Unity Indie 2.6.0.(If you get a missing DLL Error, then you may need to download the source files from his website, and rebuild the DLL's &amp;gt; I fixed this in the updated archive on my website, thanks for the tip)&lt;br /&gt;
&lt;br /&gt;
== Native Code Plugins ==&lt;br /&gt;
&lt;br /&gt;
Native code plugins can be written in many languages, including C and C++. A Unity Pro licence is required to use these plugins. This kind of plugin can only be used in the editor and in standalone builds.  The web player is prevented from using them for security reasons.&lt;br /&gt;
&lt;br /&gt;
The Unity documentation outlines how native code plugins are made [http://unity3d.com/support/documentation/Manual/Plugins.html here].&lt;br /&gt;
&lt;br /&gt;
=== Cross-Platform Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie to a texture with synchronized sound.&lt;br /&gt;
&lt;br /&gt;
*[[UniWii]] - Use Wiimotes as input devices.&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X Only Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - Use AudioInput.Volume to provide microphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - Display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
[[Category:.NET Plugins]]&lt;br /&gt;
[[Category:Native Code Plugins]]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Unity_Explosivo!</id>
		<title>Unity Explosivo!</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Unity_Explosivo!"/>
				<updated>2012-08-08T09:45:54Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Apparently relative URLs are no go. Replaced with new absolute ones.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== '''Welcome to Unity Explosivo!''' ==&lt;br /&gt;
&lt;br /&gt;
'''Updates:'''&lt;br /&gt;
* Ok that's it! Explosivo! is over and '''we have winners!'''&lt;br /&gt;
&lt;br /&gt;
Your winners are:&lt;br /&gt;
&lt;br /&gt;
'''1st Place: ''Singularity Bomb'' - drJones''' with 42% of the vote!&lt;br /&gt;
&lt;br /&gt;
'''Runner Up: ''Explosion Sculptures'' - metervara''' with 30% of the vote!&lt;br /&gt;
&lt;br /&gt;
Everyone else, thanks for participating! &lt;br /&gt;
&lt;br /&gt;
All in all, it looks like most everyone had a good time. Let's keep these contests going and do another soon! Thanks again for doing your part to keep this contest fun &amp;amp; honest!&lt;br /&gt;
&lt;br /&gt;
* '''The contest entry period is over and all the entries look sweet!''' Thanks to all who entered! &lt;br /&gt;
* ''Page is now locked to allow for voting! :)''&lt;br /&gt;
&lt;br /&gt;
'''Voting'''&lt;br /&gt;
* The voting criteria is simply this: '''Vote for the coolest &amp;amp; most imaginative explosion''' (whatever that means to you) and the entry with the most votes wins ''the grand prize!'' The entry with the next highest number of votes, takes the runner up prize! After that well, better luck next time! :)&lt;br /&gt;
* Let the Voting commence! Unity forum goers (goers eh? wink wink nudge nudge), place your vote here: http://forum.unity3d.com/viewtopic.php?t=6110&lt;br /&gt;
&lt;br /&gt;
'''What is it?'''&lt;br /&gt;
* Simply, Unity users take a fixed amount of time to make cool explosions. Unity users can vote for '''the coolest &amp;amp; most imaginative explosion''' at the end and the explosion with the most votes wins! &lt;br /&gt;
&lt;br /&gt;
Satisfy your primal need for blowing things up, in the warm and forgiving arms of Unity. This is a &amp;quot;for-fun&amp;quot; contest (meaning no out-and-out $$, but there is a grand prize incentive courtesy of OTEE!) :P&lt;br /&gt;
&lt;br /&gt;
'''Rules:'''&lt;br /&gt;
&lt;br /&gt;
* 0. Contest runs for 3 weeks from Saturday June 23rd, 2007 @ Midnight until '''the updated deadline of''' July 14th 2007 @ Midnight (Saturday night).&lt;br /&gt;
&lt;br /&gt;
* 1. Free Reign! Anyone can enter (Unity trial, Indy, Pro, etc.)!&lt;br /&gt;
&lt;br /&gt;
* 2. Voting will be done via the OTEE Unity forums here (special vote thread to be created near the contest end). [http://forum.unity3d.com/viewtopic.php?p=41137#41137 Unity Explosivo! announcement on OTEE forums]&lt;br /&gt;
&lt;br /&gt;
* 3. Since this is an interactive community, the explosion needs to be user-triggered. Can be an elaborate trigger (wild &amp;amp; crazy) or just &amp;quot;press space to detonate&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
* 4. All explosions need to be made public here on the wiki for the benefit of all.&lt;br /&gt;
&lt;br /&gt;
* 5. Enter as many explosions as you like.&lt;br /&gt;
&lt;br /&gt;
* 6. Should be a new explosion effect, made during the time of the contest. So if you are already working on a game called Explosion-A-Go-Go, try to resist the temptation to use your existing stuff eh? :)&lt;br /&gt;
&lt;br /&gt;
* 7. Variety is strongly encouraged (how many ways can you express the idea of an &amp;quot;Explosion!&amp;quot;) :)&lt;br /&gt;
&lt;br /&gt;
'''Prizes:'''&lt;br /&gt;
&lt;br /&gt;
*''1st Place'' - Winner will receive a free pass to Unite 2007 the Unity User conference, courtesy the guys at the generous and giving OTEE. The conference is October 10-12th at the San Francisco Film Centre, in (you guessed it) San Francisco California. You will need to arrange travel &amp;amp; lodging for the show, but it remains a $400 value! If the winner already has a pass to the show (cough cough Yoggy! cough), the prize will defer to the runner-up and so forth.&lt;br /&gt;
&lt;br /&gt;
*''Runner up'' - The runner up winner will now receive a full license to Cheetah 3D, courtesy of the very generous Martin Wengenmayer! That's a $129 value folks! Check out the impressive artwork being created with this Unity friendly tool over at: http://www.cheetah3d.com! If the winner already has this prize, it will defer to the next runner-up and so forth.&lt;br /&gt;
&lt;br /&gt;
*''All other entrants'' - will receive no money or prizes, but when you die, on your deathbed, you will receive total consciousness. So you'd have that going for you. Also, the satisfaction of standing out amongst your peers with all the fame and notoriety that goes with it (so nothing really!) &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If enough entrants, will consider branching into various winner categories; most creative, most elaborate, etc. &lt;br /&gt;
&lt;br /&gt;
And since yes, this is a &amp;quot;for-fun&amp;quot; contest, any zealots please try to stay in the rules and just have some fun will ya!&lt;br /&gt;
&lt;br /&gt;
Ready? Set? '''''Blow!'''''&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Official Entries for Voting''' ==&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Independence Day Soldier''' ==&lt;br /&gt;
*YOU ARE SOLDIER! Can you make the biggest and bestest!&lt;br /&gt;
[[Image:fireworks.jpg]]&lt;br /&gt;
*''Links:'' [http://wiki.unity3d.com/contests/explosivo_web/Yoggy/Independence_Day_Soldier_mac.zip Independence Day Soldier Mac Standalone]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.unity3d.com/contests/explosivo_web/Yoggy/Independence_Day_Soldier_win.zip Independence Day Soldier Windows Standalone]&lt;br /&gt;
&lt;br /&gt;
--[[User:Yoggy|yoggy]] 12:48, 3 July 2007 (MST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Explosion Sculptures''' ==&lt;br /&gt;
*Explosion sculpture generator with 17 tweakable parameters for maximum flexibility!&lt;br /&gt;
[[Image:Explosivo.jpg]]&lt;br /&gt;
*''Link:'' [http://wiki.unity3d.com/contests/explosivo_web/Metervara/explosivo.html L-System Explosion Web Player]&lt;br /&gt;
&lt;br /&gt;
*[[Media:ExpSculpture.unitypackage.zip|ExpSculpture.unitypackage.zip]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Metervara|metervara]] 11:02 4 July 2007 (CEST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Kaboom''' ==&lt;br /&gt;
[[Image:daniels_explosivo_entry.jpg]]&lt;br /&gt;
*''Links:''  [http://wiki.unity3d.com/contests/explosivo_web/Daniel/explosivo.html Kaboom Web Player]&lt;br /&gt;
&lt;br /&gt;
--[[User:Daniel|Daniel]] 10:52, 14 July 2007 (PDT)&lt;br /&gt;
&lt;br /&gt;
== '''Leviathan Explosion''' ==&lt;br /&gt;
*I'm developing this for my game Phoenix Final (although all the code is totally separate for the purpose of this contest).  I will be dynamically breaking the original spaceship mesh into random pieces at runtime.&lt;br /&gt;
[[Image:Leviathan_crash_2.jpg]]&lt;br /&gt;
&lt;br /&gt;
''Links:''&lt;br /&gt;
*[http://wiki.unity3d.com/contests/explosivo_web/NCarter/explosivo.html Leviathan Explosion Web Player]&lt;br /&gt;
*[http://www.nether.org.uk/files/pf/leviathan_explosion_project.zip Unity Project]&lt;br /&gt;
--[[User:NCarter|NCarter]] 15:17, 5 July 2007 (PDT)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Singularity Bomb''' ==&lt;br /&gt;
[[Image:Baddaboom.jpg]]&lt;br /&gt;
*''Links:'' [http://wiki.unity3d.com/contests/explosivo_web/DrJones/explosivo.html Singularity Bomb Web Player]&lt;br /&gt;
--[[User:DrJones|DrJones]] 06:02, 6 July 2007 (PDT)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Six Bomb - Go forth and Multiply''' ==&lt;br /&gt;
[[Image:Sixbombcrop.jpg]]&lt;br /&gt;
*''Links: ''[http://wiki.unity3d.com/contests/explosivo_web/CBLarsen/explosivo.html Six Bomb Web Player] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.unity3d.com/contests/explosivo_web/CBLarsen/SixBomb_mac.zip Six Bomb Mac OS X Universal (7.8 MB)] &lt;br /&gt;
&lt;br /&gt;
[http://wiki.unity3d.com/contests/explosivo_web/CBLarsen/SixBomb_win.zip Six Bomb Windows (3.9 MB)] &lt;br /&gt;
&lt;br /&gt;
[http://proglet.com/software/SixBomb/project/SixBomb.zip SixBomb full project source (5.1MB)]&lt;br /&gt;
&lt;br /&gt;
--[[User:cblarsen|cblarsen]] 17:01, 2 July 2007 (PDT)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''M-80 + Bathroom''' ==&lt;br /&gt;
*Hopefully this is self-explanatory ;) ... Standard WASD plus F to &amp;quot;fling&amp;quot; M-80s into the toilets etc... it's best if you stand still while throwing them or they're not going to go too far. The trash can is really hard to hit. &lt;br /&gt;
[[Image:picture_2.jpg]]&lt;br /&gt;
*''Links:'' [http://wiki.unity3d.com/contests/explosivo_web/Ethan/explosivo.html M-80 + Bathroom Web Player]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.unity3d.com/contests/explosivo_web/Ethan/M-80+Bathroom_UB.zip Mac Universal Standalone] &lt;br /&gt;
&lt;br /&gt;
[http://www.antennatree.net/examples/M-80Project.zip M-80 + Bathroom Project]&lt;br /&gt;
&lt;br /&gt;
--[[User:Ethan|Ethan]] 8:10, 7 July 2007 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Kablooey!''' ==&lt;br /&gt;
*I wanted to blow up something big. unfinished but oh well :P Use A &amp;amp; D to activate explosions.&lt;br /&gt;
[[Image:petes_explosivo_entry.jpg]]&lt;br /&gt;
*''Links:'' [http://wiki.unity3d.com/contests/explosivo_web/Pete/explosivo.html Kablooey! Web Player]&lt;br /&gt;
--[[User:Pete|Pete]] 8:10, 7 July 2007 (EST)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Explosives''' ==&lt;br /&gt;
*Hi, my entry, the instructions are in the HTML itself, master the plasma! is the best!&lt;br /&gt;
[[Image:omars_explosivo_entry.jpg]]&lt;br /&gt;
*''Links:'' [http://wiki.unity3d.com/contests/explosivo_web/Omar/explosivo.html Explosives Web Player]&lt;br /&gt;
--[[User:Omar Rojo|Omar Rojo]] 06:38, 12 July 2007 (PDT)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Bomb the Barn''' ==&lt;br /&gt;
*Title is topic. Right-click and choose Go Fullscreen for the most effect. Happy bombing...&lt;br /&gt;
[[Image:BtB.jpg]]&lt;br /&gt;
*''Links:'' [http://wiki.unity3d.com/contests/explosivo_web/Timo/explosivo.html Bomb the Barn Web Player]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.unity3d.com/contests/explosivo_web/Timo/BombTheBarn_MacUni.app.zip Bomb the Barn Mac Universal Standalone]&lt;br /&gt;
&lt;br /&gt;
[http://wiki.unity3d.com/contests/explosivo_web/Timo/BombTheBarn_Win.zip Bomb the Barn Windows Standalone]&lt;br /&gt;
&lt;br /&gt;
[[Media:BombTheBarn_projectfolder.zip|Unity Project Folder]]&lt;br /&gt;
&lt;br /&gt;
--[[User:T|Timo]] 14 July 2007&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== '''Non-Voting Entries''' ==&lt;br /&gt;
Entries that, for whatever reason, were pulled from the contest.&lt;br /&gt;
----&lt;br /&gt;
----&lt;br /&gt;
== '''Direct Action Training''' ==&lt;br /&gt;
* ''The author requested that this entry be pulled from the contest'' :(&lt;br /&gt;
* Booom Booom !&lt;br /&gt;
[[Image:targos_explosivo_entry.jpg]]&lt;br /&gt;
*''Links [http://wiki.unity3d.com/contests/explosivo_web/Targos/explosivo.html Direct Action Training Web Player]''&lt;br /&gt;
Link is to pre-deadline version.&lt;br /&gt;
&lt;br /&gt;
--[[User:Targos|Targos]] 05:17, 13 July 2007 (PDT)&lt;br /&gt;
----&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Main_Page"/>
				<updated>2012-08-07T12:55:49Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Removed hosting donations link.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &amp;lt;div style=&amp;quot;width: 60%; margin: auto; background: #FFFFF; border: 1px solid #131313&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;background: #C8C4BD; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center;&amp;quot;&amp;gt;Welcome to the UnifyWiki&amp;lt;br /&amp;gt;The UnifyWiki is part of the [http://unifycommunity.com Unify Community] and is a place to find and share [http://unity3d.com/ Unity] knowledge. &amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%; margin: auto; text-align: center; border: none;&amp;quot;&lt;br /&gt;
| [[File:Splash.jpg|link=Main_Page]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Wiki News&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* Unity Tech has taken over hosting and day to day maintenance of the community wiki. Aside from that, everything should be business as usual. We would like to thank the previous maintainers of the wiki for their amazing dedication and hard work. - ''AngryAnt''&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: #F00;&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/span&amp;gt; syntax highlighting now uses different tags.  Where you previously could write '''&amp;lt;nowiki&amp;gt;&amp;lt;csharp&amp;gt;, &amp;lt;javascript&amp;gt;&amp;lt;/nowiki&amp;gt;''' or '''&amp;lt;nowiki&amp;gt;&amp;lt;boo&amp;gt;&amp;lt;/nowiki&amp;gt;''', you now have to write '''&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;csharp&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;'''.  The names used for each language have not changed.  You can learn more about the syntax highlighter's features [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi here].&lt;br /&gt;
&lt;br /&gt;
* The spam filter has been tightened a bit.  If the wiki refuses an edit because it says it's spam and you don't know why, please contact an administrator.&lt;br /&gt;
&lt;br /&gt;
* It is possible to upload '''zip''' archives to the Unify wiki.  We encourage you to provide a zipped copy of your script or shader when adding a new article, as this will help to avoid problems with various web browsers where garbage characters are introduced into text which is copied and pasted from these pages.&lt;br /&gt;
&lt;br /&gt;
* The maximum file size for any uploaded file is now '''512KB''', and this includes images as well as zip files.  Unfortunately, '''unityPackage''' files are not directly supported at present, as we have been unable to make MediaWiki recognise the unusually long filename extension.  If you wish to add a unityPackage to the wiki, please zip it first.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 40%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Notes&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
Special thanks to [[User:Aarku|Aarku]], [[User:Dho|Dho]], [[User:NCarter|NCarter]], [[User:KeliHlodversson|Freyr]], [[User:Outcast|Outcast]] and others.&lt;br /&gt;
&lt;br /&gt;
We're currently working on [[Special:Statistics|{{NUMBEROFARTICLES}}]] [[Special:Allpages|articles]] about Unity and related subjects.&lt;br /&gt;
&lt;br /&gt;
Please see the [[:Talk:Main Page|discussion page]] of the main page for current goals and status.  '''Please read these [[:Help:Contents|general guidelines]] before you begin editing.'''&lt;br /&gt;
&lt;br /&gt;
To create a new page, add a link to an existing page, then follow the link and edit the new page. It's a good idea to copy the layout from an existing page initially, to ensure that your contribution matches the conventions used in our existing articles.  If you just want to experiment, you can do so in the [[:Unify Community Wiki:Sandbox|sandbox]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Main Sections&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Extensions]] - Further extend the functionality of Unity with .NET plugins (suitable for any Unity licence) and native code plugins (for Pro users only).&lt;br /&gt;
&lt;br /&gt;
* [[Particle Library]] - Pre-configured particle systems for use in your own projects.&lt;br /&gt;
&lt;br /&gt;
* [[Programming]] - Unity programming resources&lt;br /&gt;
&lt;br /&gt;
* [[Scripts]] - Everything from general purpose effects to debugging.&lt;br /&gt;
&lt;br /&gt;
* [[Shaders]] - Specialised shaders to make your materials more refined.&lt;br /&gt;
&lt;br /&gt;
* [[Wizards]] - Scripts to extend the Unity editor.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Extras&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Tips|Tips, Tools &amp;amp; Tricks]] - Tips and tricks for editing Unity content and supported tools &amp;amp; applications.&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials]] - Tutorials for all things Unity.  These are usually of larger scope than [[Tips|Tips and Tricks]].&lt;br /&gt;
&lt;br /&gt;
* [[Contests]] - User contests for fun and fame!&lt;br /&gt;
&lt;br /&gt;
* [[Unity Projects]] - Community development efforts to extend Unity.&lt;br /&gt;
&lt;br /&gt;
* [[IRC|IRC Chatroom]] - Your portal to the Unity community.&lt;br /&gt;
&lt;br /&gt;
* [[Unify Community Wiki:Community Portal|Community Portal]] - Your portal to the Unity community.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Support&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
*Please see [http://meta.wikipedia.org/wiki/MediaWiki_i18n documentation on customizing the interface] and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide MediaWiki User's Guide] for usage and configuration help.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Main_Page"/>
				<updated>2012-08-07T12:49:39Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Thanks as well :)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &amp;lt;div style=&amp;quot;width: 60%; margin: auto; background: #FFFFF; border: 1px solid #131313&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;background: #C8C4BD; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center;&amp;quot;&amp;gt;Welcome to the UnifyWiki&amp;lt;br /&amp;gt;The UnifyWiki is part of the [http://unifycommunity.com Unify Community] and is a place to find and share [http://unity3d.com/ Unity] knowledge. &amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%; margin: auto; text-align: center; border: none;&amp;quot;&lt;br /&gt;
| [[File:Splash.jpg|link=Main_Page]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Wiki News&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* Unity Tech has taken over hosting and day to day maintenance of the community wiki. Aside from that, everything should be business as usual. We would like to thank the previous maintainers of the wiki for their amazing dedication and hard work. - ''AngryAnt''&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: #F00;&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/span&amp;gt; syntax highlighting now uses different tags.  Where you previously could write '''&amp;lt;nowiki&amp;gt;&amp;lt;csharp&amp;gt;, &amp;lt;javascript&amp;gt;&amp;lt;/nowiki&amp;gt;''' or '''&amp;lt;nowiki&amp;gt;&amp;lt;boo&amp;gt;&amp;lt;/nowiki&amp;gt;''', you now have to write '''&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;csharp&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;'''.  The names used for each language have not changed.  You can learn more about the syntax highlighter's features [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi here].&lt;br /&gt;
&lt;br /&gt;
* The spam filter has been tightened a bit.  If the wiki refuses an edit because it says it's spam and you don't know why, please contact an administrator.&lt;br /&gt;
&lt;br /&gt;
* It is possible to upload '''zip''' archives to the Unify wiki.  We encourage you to provide a zipped copy of your script or shader when adding a new article, as this will help to avoid problems with various web browsers where garbage characters are introduced into text which is copied and pasted from these pages.&lt;br /&gt;
&lt;br /&gt;
* The maximum file size for any uploaded file is now '''512KB''', and this includes images as well as zip files.  Unfortunately, '''unityPackage''' files are not directly supported at present, as we have been unable to make MediaWiki recognise the unusually long filename extension.  If you wish to add a unityPackage to the wiki, please zip it first.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 40%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Notes&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
Special thanks to [[User:Aarku|Aarku]], [[User:Dho|Dho]], [[User:NCarter|NCarter]], [[User:KeliHlodversson|Freyr]], [[User:Outcast|Outcast]] and others.&lt;br /&gt;
&lt;br /&gt;
We're currently working on [[Special:Statistics|{{NUMBEROFARTICLES}}]] [[Special:Allpages|articles]] about Unity and related subjects.&lt;br /&gt;
&lt;br /&gt;
Please see the [[:Talk:Main Page|discussion page]] of the main page for current goals and status.  '''Please read these [[:Help:Contents|general guidelines]] before you begin editing.'''&lt;br /&gt;
&lt;br /&gt;
To create a new page, add a link to an existing page, then follow the link and edit the new page. It's a good idea to copy the layout from an existing page initially, to ensure that your contribution matches the conventions used in our existing articles.  If you just want to experiment, you can do so in the [[:Unify Community Wiki:Sandbox|sandbox]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Main Sections&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Extensions]] - Further extend the functionality of Unity with .NET plugins (suitable for any Unity licence) and native code plugins (for Pro users only).&lt;br /&gt;
&lt;br /&gt;
* [[Particle Library]] - Pre-configured particle systems for use in your own projects.&lt;br /&gt;
&lt;br /&gt;
* [[Programming]] - Unity programming resources&lt;br /&gt;
&lt;br /&gt;
* [[Scripts]] - Everything from general purpose effects to debugging.&lt;br /&gt;
&lt;br /&gt;
* [[Shaders]] - Specialised shaders to make your materials more refined.&lt;br /&gt;
&lt;br /&gt;
* [[Wizards]] - Scripts to extend the Unity editor.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Extras&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Tips|Tips, Tools &amp;amp; Tricks]] - Tips and tricks for editing Unity content and supported tools &amp;amp; applications.&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials]] - Tutorials for all things Unity.  These are usually of larger scope than [[Tips|Tips and Tricks]].&lt;br /&gt;
&lt;br /&gt;
* [[Contests]] - User contests for fun and fame!&lt;br /&gt;
&lt;br /&gt;
* [[Unity Projects]] - Community development efforts to extend Unity.&lt;br /&gt;
&lt;br /&gt;
* [[IRC|IRC Chatroom]] - Your portal to the Unity community.&lt;br /&gt;
&lt;br /&gt;
* [[Unify Community Wiki:Community Portal|Community Portal]] - Your portal to the Unity community.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Support Unify Wiki&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*[http://www.dreamhost.com/donate.cgi?id=9231 Donate towards hosting of this wiki!]&lt;br /&gt;
&lt;br /&gt;
*[http://www.printfection.com/unifycommunity/ Unify Community Merch]&lt;br /&gt;
&lt;br /&gt;
*Please see [http://meta.wikipedia.org/wiki/MediaWiki_i18n documentation on customizing the interface] and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide MediaWiki User's Guide] for usage and configuration help.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Main_Page"/>
				<updated>2012-08-07T12:45:21Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Less elaborate.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &amp;lt;div style=&amp;quot;width: 60%; margin: auto; background: #FFFFF; border: 1px solid #131313&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;background: #C8C4BD; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center;&amp;quot;&amp;gt;Welcome to the UnifyWiki&amp;lt;br /&amp;gt;The UnifyWiki is part of the [http://unifycommunity.com Unify Community] and is a place to find and share [http://unity3d.com/ Unity] knowledge. &amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%; margin: auto; text-align: center; border: none;&amp;quot;&lt;br /&gt;
| [[File:Splash.jpg|link=Main_Page]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Wiki News&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* Unity Tech has taken over hosting and day to day maintenance of the community wiki. Aside from that, everything should be business as usual. - ''AngryAnt''&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: #F00;&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/span&amp;gt; syntax highlighting now uses different tags.  Where you previously could write '''&amp;lt;nowiki&amp;gt;&amp;lt;csharp&amp;gt;, &amp;lt;javascript&amp;gt;&amp;lt;/nowiki&amp;gt;''' or '''&amp;lt;nowiki&amp;gt;&amp;lt;boo&amp;gt;&amp;lt;/nowiki&amp;gt;''', you now have to write '''&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;csharp&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;'''.  The names used for each language have not changed.  You can learn more about the syntax highlighter's features [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi here].&lt;br /&gt;
&lt;br /&gt;
* The spam filter has been tightened a bit.  If the wiki refuses an edit because it says it's spam and you don't know why, please contact an administrator.&lt;br /&gt;
&lt;br /&gt;
* It is possible to upload '''zip''' archives to the Unify wiki.  We encourage you to provide a zipped copy of your script or shader when adding a new article, as this will help to avoid problems with various web browsers where garbage characters are introduced into text which is copied and pasted from these pages.&lt;br /&gt;
&lt;br /&gt;
* The maximum file size for any uploaded file is now '''512KB''', and this includes images as well as zip files.  Unfortunately, '''unityPackage''' files are not directly supported at present, as we have been unable to make MediaWiki recognise the unusually long filename extension.  If you wish to add a unityPackage to the wiki, please zip it first.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 40%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Notes&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
Special thanks to [[User:Aarku|Aarku]], [[User:Dho|Dho]], [[User:NCarter|NCarter]], [[User:KeliHlodversson|Freyr]], [[User:Outcast|Outcast]] and others.&lt;br /&gt;
&lt;br /&gt;
We're currently working on [[Special:Statistics|{{NUMBEROFARTICLES}}]] [[Special:Allpages|articles]] about Unity and related subjects.&lt;br /&gt;
&lt;br /&gt;
Please see the [[:Talk:Main Page|discussion page]] of the main page for current goals and status.  '''Please read these [[:Help:Contents|general guidelines]] before you begin editing.'''&lt;br /&gt;
&lt;br /&gt;
To create a new page, add a link to an existing page, then follow the link and edit the new page. It's a good idea to copy the layout from an existing page initially, to ensure that your contribution matches the conventions used in our existing articles.  If you just want to experiment, you can do so in the [[:Unify Community Wiki:Sandbox|sandbox]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Main Sections&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Extensions]] - Further extend the functionality of Unity with .NET plugins (suitable for any Unity licence) and native code plugins (for Pro users only).&lt;br /&gt;
&lt;br /&gt;
* [[Particle Library]] - Pre-configured particle systems for use in your own projects.&lt;br /&gt;
&lt;br /&gt;
* [[Programming]] - Unity programming resources&lt;br /&gt;
&lt;br /&gt;
* [[Scripts]] - Everything from general purpose effects to debugging.&lt;br /&gt;
&lt;br /&gt;
* [[Shaders]] - Specialised shaders to make your materials more refined.&lt;br /&gt;
&lt;br /&gt;
* [[Wizards]] - Scripts to extend the Unity editor.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Extras&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Tips|Tips, Tools &amp;amp; Tricks]] - Tips and tricks for editing Unity content and supported tools &amp;amp; applications.&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials]] - Tutorials for all things Unity.  These are usually of larger scope than [[Tips|Tips and Tricks]].&lt;br /&gt;
&lt;br /&gt;
* [[Contests]] - User contests for fun and fame!&lt;br /&gt;
&lt;br /&gt;
* [[Unity Projects]] - Community development efforts to extend Unity.&lt;br /&gt;
&lt;br /&gt;
* [[IRC|IRC Chatroom]] - Your portal to the Unity community.&lt;br /&gt;
&lt;br /&gt;
* [[Unify Community Wiki:Community Portal|Community Portal]] - Your portal to the Unity community.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Support Unify Wiki&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*[http://www.dreamhost.com/donate.cgi?id=9231 Donate towards hosting of this wiki!]&lt;br /&gt;
&lt;br /&gt;
*[http://www.printfection.com/unifycommunity/ Unify Community Merch]&lt;br /&gt;
&lt;br /&gt;
*Please see [http://meta.wikipedia.org/wiki/MediaWiki_i18n documentation on customizing the interface] and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide MediaWiki User's Guide] for usage and configuration help.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Main_Page"/>
				<updated>2012-08-07T12:38:28Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Added news about wiki administration.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
| colspan=&amp;quot;3&amp;quot; | &amp;lt;div style=&amp;quot;width: 60%; margin: auto; background: #FFFFF; border: 1px solid #131313&amp;quot;&amp;gt;&amp;lt;div style=&amp;quot;background: #C8C4BD; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center;&amp;quot;&amp;gt;Welcome to the UnifyWiki&amp;lt;br /&amp;gt;The UnifyWiki is part of the [http://unifycommunity.com Unify Community] and is a place to find and share [http://unity3d.com/ Unity] knowledge. &amp;lt;br /&amp;gt;&amp;lt;/div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%; margin: auto; text-align: center; border: none;&amp;quot;&lt;br /&gt;
| [[File:Splash.jpg|link=Main_Page]] &lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
{| style=&amp;quot;width: 100%;&amp;quot; cellspacing=&amp;quot;5&amp;quot; cellpadding=&amp;quot;0&amp;quot;&lt;br /&gt;
&lt;br /&gt;
| colspan=&amp;quot;2&amp;quot; style=&amp;quot;background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Wiki News&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* Due to frequent hacking and a fall in the number of people involved in maintaining the wiki, Unity Technologies has taken over hosting and day to day maintenance of the community wiki. We have no plans on changing anything other than the uptime of the site. All content on the wiki remains public domain and we encourage everyone to contribute as per usual. - ''AngryAnt''&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;span style=&amp;quot;color: #F00;&amp;quot;&amp;gt;'''IMPORTANT:'''&amp;lt;/span&amp;gt; syntax highlighting now uses different tags.  Where you previously could write '''&amp;lt;nowiki&amp;gt;&amp;lt;csharp&amp;gt;, &amp;lt;javascript&amp;gt;&amp;lt;/nowiki&amp;gt;''' or '''&amp;lt;nowiki&amp;gt;&amp;lt;boo&amp;gt;&amp;lt;/nowiki&amp;gt;''', you now have to write '''&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight lang=&amp;quot;csharp&amp;quot;&amp;gt;&amp;lt;/nowiki&amp;gt;'''.  The names used for each language have not changed.  You can learn more about the syntax highlighter's features [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi here].&lt;br /&gt;
&lt;br /&gt;
* The spam filter has been tightened a bit.  If the wiki refuses an edit because it says it's spam and you don't know why, please contact an administrator.&lt;br /&gt;
&lt;br /&gt;
* It is possible to upload '''zip''' archives to the Unify wiki.  We encourage you to provide a zipped copy of your script or shader when adding a new article, as this will help to avoid problems with various web browsers where garbage characters are introduced into text which is copied and pasted from these pages.&lt;br /&gt;
&lt;br /&gt;
* The maximum file size for any uploaded file is now '''512KB''', and this includes images as well as zip files.  Unfortunately, '''unityPackage''' files are not directly supported at present, as we have been unable to make MediaWiki recognise the unusually long filename extension.  If you wish to add a unityPackage to the wiki, please zip it first.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;width: 40%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Notes&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
Special thanks to [[User:Aarku|Aarku]], [[User:Dho|Dho]], [[User:NCarter|NCarter]], [[User:KeliHlodversson|Freyr]], [[User:Outcast|Outcast]] and others.&lt;br /&gt;
&lt;br /&gt;
We're currently working on [[Special:Statistics|{{NUMBEROFARTICLES}}]] [[Special:Allpages|articles]] about Unity and related subjects.&lt;br /&gt;
&lt;br /&gt;
Please see the [[:Talk:Main Page|discussion page]] of the main page for current goals and status.  '''Please read these [[:Help:Contents|general guidelines]] before you begin editing.'''&lt;br /&gt;
&lt;br /&gt;
To create a new page, add a link to an existing page, then follow the link and edit the new page. It's a good idea to copy the layout from an existing page initially, to ensure that your contribution matches the conventions used in our existing articles.  If you just want to experiment, you can do so in the [[:Unify Community Wiki:Sandbox|sandbox]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Main Sections&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
* [[Extensions]] - Further extend the functionality of Unity with .NET plugins (suitable for any Unity licence) and native code plugins (for Pro users only).&lt;br /&gt;
&lt;br /&gt;
* [[Particle Library]] - Pre-configured particle systems for use in your own projects.&lt;br /&gt;
&lt;br /&gt;
* [[Programming]] - Unity programming resources&lt;br /&gt;
&lt;br /&gt;
* [[Scripts]] - Everything from general purpose effects to debugging.&lt;br /&gt;
&lt;br /&gt;
* [[Shaders]] - Specialised shaders to make your materials more refined.&lt;br /&gt;
&lt;br /&gt;
* [[Wizards]] - Scripts to extend the Unity editor.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Extras&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
* [[Tips|Tips, Tools &amp;amp; Tricks]] - Tips and tricks for editing Unity content and supported tools &amp;amp; applications.&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials]] - Tutorials for all things Unity.  These are usually of larger scope than [[Tips|Tips and Tricks]].&lt;br /&gt;
&lt;br /&gt;
* [[Contests]] - User contests for fun and fame!&lt;br /&gt;
&lt;br /&gt;
* [[Unity Projects]] - Community development efforts to extend Unity.&lt;br /&gt;
&lt;br /&gt;
* [[IRC|IRC Chatroom]] - Your portal to the Unity community.&lt;br /&gt;
&lt;br /&gt;
* [[Unify Community Wiki:Community Portal|Community Portal]] - Your portal to the Unity community.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
| style=&amp;quot;width: 33%; background: #FFFFFF; border: 1px solid #AAA; vertical-align: top;&amp;quot; |&lt;br /&gt;
&amp;lt;div style=&amp;quot;background: #787878; border: 1px solid #131313; padding: 5px; margin: 3px; font-weight: bold; text-align: center; font-size: 120%;&amp;quot;&amp;gt;Support Unify Wiki&amp;lt;/div&amp;gt;&lt;br /&gt;
&amp;lt;div style=&amp;quot;padding-left: 1em;&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
*[http://www.dreamhost.com/donate.cgi?id=9231 Donate towards hosting of this wiki!]&lt;br /&gt;
&lt;br /&gt;
*[http://www.printfection.com/unifycommunity/ Unify Community Merch]&lt;br /&gt;
&lt;br /&gt;
*Please see [http://meta.wikipedia.org/wiki/MediaWiki_i18n documentation on customizing the interface] and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide MediaWiki User's Guide] for usage and configuration help.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2010-05-06T07:48:53Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Mapping static methods to singleton methods */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton () &lt;br /&gt;
	{&lt;br /&gt;
		if (instance != null)&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton ();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				instance = new GameObject (&amp;quot;MySingleton&amp;quot;).AddComponent&amp;lt;MySingleton&amp;gt; ();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit ()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log (&amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if (timer &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mapping static methods to singleton methods ==&lt;br /&gt;
Having to go through the Instance property for every function of the singleton gets old fast. Really the user most of the time does not need to know that he is dealing with a singleton, so this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
should for simplicity be remapped to this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Register (gameObject);&lt;br /&gt;
MySingleton.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
To make the above true, simply make your methods static and have *them* take the pain of going through the Instance property - like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return Instance.timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			Instance.timer = value;&lt;br /&gt;
			if (value &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in Instance.listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		Instance.listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!Instance.listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		Instance.listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Voilá! Less cruft in the world! Everyone rejoice!&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2010-05-04T13:08:16Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton () &lt;br /&gt;
	{&lt;br /&gt;
		if (instance != null)&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton ();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				instance = new GameObject (&amp;quot;MySingleton&amp;quot;).AddComponent&amp;lt;MySingleton&amp;gt; ();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit ()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log (&amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if (timer &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mapping static methods to singleton methods ==&lt;br /&gt;
Having to go through the Instance property for every function of the singleton gets old fast. Really the user most of the time does not need to know that he is dealing with a singleton, so this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
is really quite simple when it should just be this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Register (gameObject);&lt;br /&gt;
MySingleton.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
To make the above true, simply make your methods static and have *them* take the pain of going through the Instance property - like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return Instance.timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			Instance.timer = value;&lt;br /&gt;
			if (value &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in Instance.listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		Instance.listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!Instance.listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		Instance.listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Voilá! Less cruft in the world! Everyone rejoice!&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2010-05-04T13:03:23Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton () &lt;br /&gt;
	{&lt;br /&gt;
		if (instance != null)&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton ();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				instance = new GameObject (&amp;quot;MySingleton&amp;quot;).AddComponent&amp;lt;MySingleton&amp;gt; ();&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit ()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log (&amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if (timer &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mapping static methods to singleton methods ==&lt;br /&gt;
Having to go through the Instance property for every function of the singleton gets old fast. Really the user most of the time does not need to know that he is dealing with a singleton, so this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
is really quite simple when it should just be this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Register (gameObject);&lt;br /&gt;
MySingleton.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
To make the above true, simply make your methods static and have *them* take the pain of going through the Instance property - like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return Instance.timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			Instance.timer = value;&lt;br /&gt;
			if (value &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in Instance.listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		Instance.listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!Instance.listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		Instance.listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Voilá! Less cruft in the world! Everyone rejoice!&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2010-05-04T12:11:11Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton () &lt;br /&gt;
	{&lt;br /&gt;
		if (instance != null)&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton ();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			GameObject go;&lt;br /&gt;
&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				go = new GameObject (&amp;quot;MySingleton&amp;quot;);&lt;br /&gt;
				instance = (MySingleton)go.AddComponent (typeof (MySingleton));&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit ()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log (&amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if (timer &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mapping static methods to singleton methods ==&lt;br /&gt;
Having to go through the Instance property for every function of the singleton gets old fast. Really the user most of the time does not need to know that he is dealing with a singleton, so this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
is really quite simple when it should just be this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Register (gameObject);&lt;br /&gt;
MySingleton.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
To make the above true, simply make your methods static and have *them* take the pain of going through the Instance property - like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return Instance.timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			Instance.timer = value;&lt;br /&gt;
			if (value &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in Instance.listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		Instance.listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!Instance.listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		Instance.listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Voilá! Less cruft in the world! Everyone rejoice!&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2010-05-04T12:09:34Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Added example of using static methods for singleton functionality&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton () &lt;br /&gt;
	{&lt;br /&gt;
		if (instance != null)&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton ();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			GameObject go;&lt;br /&gt;
&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				go = new GameObject (&amp;quot;MySingleton&amp;quot;);&lt;br /&gt;
				instance = (MySingleton)go.AddComponent (typeof (MySingleton));&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit ()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log (&amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register (gameObject);&lt;br /&gt;
MySingleton.Instance.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if (timer &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Mapping static methods to singleton methods ==&lt;br /&gt;
Having to go through the Instance property for every function of the singleton gets old fast. Really the user most of the time does not need to know that he is dealing with a singleton, so this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
is really quite simple when it should just be this:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Register (gameObject);&lt;br /&gt;
MySingleton.Unregister (gameObject);&amp;lt;/csharp&amp;gt;&lt;br /&gt;
To make the above true, simply make your methods static and have *them* take the pain of going through the Instance property - like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton () &lt;br /&gt;
    {&lt;br /&gt;
        if (instance != null)&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError (&amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot;);&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init ();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    private static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if (instance == null)&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton ();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init ()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList ();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return Instance.timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			Instance.timer = value;&lt;br /&gt;
			if (value &amp;lt;= 0)&lt;br /&gt;
			{&lt;br /&gt;
				foreach (GameObject listener in Instance.listeners)&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage (&amp;quot;GameOver&amp;quot;);&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static GameObject RegisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		Instance.listeners.Add (listener);&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public static bool UnregisterListener (GameObject listener)&lt;br /&gt;
	{&lt;br /&gt;
		if (!Instance.listeners.Contains (listener))&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		Instance.listeners.Remove (listener);&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Voilá! Less cruft in the world! Everyone rejoice!&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-09-22T14:12:26Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Component-based example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			GameObject go;&lt;br /&gt;
&lt;br /&gt;
			if (instance == null)&lt;br /&gt;
			{&lt;br /&gt;
				go = new GameObject (&amp;quot;MySingleton&amp;quot;);&lt;br /&gt;
				instance = (MySingleton) go.AddComponent (typeof (MySingleton));&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/CameraViewer</id>
		<title>CameraViewer</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/CameraViewer"/>
				<updated>2009-08-06T12:28:44Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Editor script code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Note: Unity Pro only.&lt;br /&gt;
&lt;br /&gt;
Install in Assets/Editor to add a &amp;quot;Camera viewer&amp;quot; item to the &amp;quot;Window&amp;quot; menu. Clicking this will launch a window which renders the output of the selected camera GameObject.&lt;br /&gt;
&lt;br /&gt;
== Editor script code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
using UnityEditor;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
&lt;br /&gt;
public class CameraViewer : EditorWindow&lt;br /&gt;
{&lt;br /&gt;
	bool liveUpdate = false;&lt;br /&gt;
	Camera camera;&lt;br /&gt;
	RenderTexture renderTexture, originalTarget;&lt;br /&gt;
	&lt;br /&gt;
	[ MenuItem( &amp;quot;Window/Camera viewer&amp;quot; ) ]&lt;br /&gt;
	static void Launch()&lt;br /&gt;
	{&lt;br /&gt;
		EditorWindow editorWindow = GetWindow( typeof( CameraViewer ) );&lt;br /&gt;
		&lt;br /&gt;
		editorWindow.Show();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void Update()&lt;br /&gt;
	{&lt;br /&gt;
		if( camera != null )&lt;br /&gt;
		{&lt;br /&gt;
			camera.Render();&lt;br /&gt;
			if( liveUpdate )&lt;br /&gt;
			{&lt;br /&gt;
				Repaint();&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void OnSelectionChange()&lt;br /&gt;
	{&lt;br /&gt;
		Camera newCamera = ( Selection.activeTransform == null ) ? null : Selection.activeTransform.gameObject.camera;&lt;br /&gt;
		&lt;br /&gt;
		if( newCamera != camera )&lt;br /&gt;
		{&lt;br /&gt;
			if( originalTarget != null )&lt;br /&gt;
			{&lt;br /&gt;
				camera.targetTexture = originalTarget;&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			camera = newCamera;&lt;br /&gt;
			if( camera != null )&lt;br /&gt;
			{&lt;br /&gt;
				originalTarget = camera.targetTexture;&lt;br /&gt;
				camera.targetTexture = renderTexture;&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
			{&lt;br /&gt;
				originalTarget = null;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void OnGUI()&lt;br /&gt;
	{&lt;br /&gt;
		if( camera == null )&lt;br /&gt;
		{&lt;br /&gt;
			ToolbarGUI( &amp;quot;No camera selection&amp;quot; );&lt;br /&gt;
			return;	&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if( renderTexture == null || renderTexture.width != position.width || renderTexture.height != position.height )&lt;br /&gt;
		{&lt;br /&gt;
			renderTexture = new RenderTexture( ( int )position.width, ( int )position.height, ( int )RenderTextureFormat.ARGB32 );&lt;br /&gt;
			camera.targetTexture = renderTexture;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		GUI.DrawTexture( new Rect( 0.0f, 0.0f, position.width, position.height ), renderTexture );&lt;br /&gt;
		&lt;br /&gt;
		ToolbarGUI( camera.gameObject.name );&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void ToolbarGUI( string title )&lt;br /&gt;
	{&lt;br /&gt;
		GUILayout.BeginHorizontal( &amp;quot;Toolbar&amp;quot; );&lt;br /&gt;
			GUILayout.Label( title );&lt;br /&gt;
			GUILayout.FlexibleSpace();&lt;br /&gt;
			liveUpdate = GUILayout.Toggle( liveUpdate, &amp;quot;Live update&amp;quot;, &amp;quot;ToolbarButton&amp;quot; );&lt;br /&gt;
		GUILayout.EndHorizontal();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/CameraViewer</id>
		<title>CameraViewer</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/CameraViewer"/>
				<updated>2009-08-06T12:26:40Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: New page: By AngryAnt.  == Description ==  Note: Unity Pro only.  Install in Assets/Editor to add a &amp;quot;Camera viewer&amp;quot; item to the &amp;quot;Window&amp;quot; menu. Clicking this will launch a window which renders the ou...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Note: Unity Pro only.&lt;br /&gt;
&lt;br /&gt;
Install in Assets/Editor to add a &amp;quot;Camera viewer&amp;quot; item to the &amp;quot;Window&amp;quot; menu. Clicking this will launch a window which renders the output of the selected camera GameObject.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
using UnityEditor;&lt;br /&gt;
using System.Collections;&lt;br /&gt;
&lt;br /&gt;
public class CameraViewer : EditorWindow&lt;br /&gt;
{&lt;br /&gt;
	bool liveUpdate = false;&lt;br /&gt;
	Camera camera;&lt;br /&gt;
	RenderTexture renderTexture, originalTarget;&lt;br /&gt;
	&lt;br /&gt;
	[ MenuItem( &amp;quot;Window/Camera viewer&amp;quot; ) ]&lt;br /&gt;
	static void Launch()&lt;br /&gt;
	{&lt;br /&gt;
		EditorWindow editorWindow = GetWindow( typeof( CameraViewer ) );&lt;br /&gt;
		&lt;br /&gt;
		editorWindow.Show();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void Update()&lt;br /&gt;
	{&lt;br /&gt;
		if( camera != null )&lt;br /&gt;
		{&lt;br /&gt;
			camera.Render();&lt;br /&gt;
			if( liveUpdate )&lt;br /&gt;
			{&lt;br /&gt;
				Repaint();&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void OnSelectionChange()&lt;br /&gt;
	{&lt;br /&gt;
		Camera newCamera = ( Selection.activeTransform == null ) ? null : Selection.activeTransform.gameObject.camera;&lt;br /&gt;
		&lt;br /&gt;
		if( newCamera != camera )&lt;br /&gt;
		{&lt;br /&gt;
			if( originalTarget != null )&lt;br /&gt;
			{&lt;br /&gt;
				camera.targetTexture = originalTarget;&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			camera = newCamera;&lt;br /&gt;
			if( camera != null )&lt;br /&gt;
			{&lt;br /&gt;
				originalTarget = camera.targetTexture;&lt;br /&gt;
				camera.targetTexture = renderTexture;&lt;br /&gt;
			}&lt;br /&gt;
			else&lt;br /&gt;
			{&lt;br /&gt;
				originalTarget = null;&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void OnGUI()&lt;br /&gt;
	{&lt;br /&gt;
		if( camera == null )&lt;br /&gt;
		{&lt;br /&gt;
			ToolbarGUI( &amp;quot;No camera selection&amp;quot; );&lt;br /&gt;
			return;	&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		if( renderTexture == null || renderTexture.width != position.width || renderTexture.height != position.height )&lt;br /&gt;
		{&lt;br /&gt;
			renderTexture = new RenderTexture( ( int )position.width, ( int )position.height, ( int )RenderTextureFormat.ARGB32 );&lt;br /&gt;
			camera.targetTexture = renderTexture;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		GUI.DrawTexture( new Rect( 0.0f, 0.0f, position.width, position.height ), renderTexture );&lt;br /&gt;
		&lt;br /&gt;
		ToolbarGUI( camera.gameObject.name );&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	void ToolbarGUI( string title )&lt;br /&gt;
	{&lt;br /&gt;
		GUILayout.BeginHorizontal( &amp;quot;Toolbar&amp;quot; );&lt;br /&gt;
			GUILayout.Label( title );&lt;br /&gt;
			GUILayout.FlexibleSpace();&lt;br /&gt;
			liveUpdate = GUILayout.Toggle( liveUpdate, &amp;quot;Live update&amp;quot;, &amp;quot;ToolbarButton&amp;quot; );&lt;br /&gt;
		GUILayout.EndHorizontal();&lt;br /&gt;
	}&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2009-02-15T13:02:20Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Rephrased wording in introduction which originally suggested that all binary plugins are platform dependant.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
These extensions, or ''plugins'', allow you to add special features to your unity projects without the hassle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
There are two kinds of plugin: those containing only .NET code and those which contain binary code.&lt;br /&gt;
&lt;br /&gt;
== .NET Plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins are simply DLLs which have been built from Mono/.NET source code. When your project is built, they are merged with the compiled Mono code from your project's scripts. This means that you can use them with a Unity Indie licence as well as with Pro and in web players.&lt;br /&gt;
&lt;br /&gt;
=== Cross-Platform Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path.html Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave.html Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-and-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X Only Plugins ===&lt;br /&gt;
&lt;br /&gt;
No entries yet.&lt;br /&gt;
&lt;br /&gt;
== Native Code Plugins ==&lt;br /&gt;
&lt;br /&gt;
Native code plugins can be written in many languages, including C and C++. A Unity Pro licence is required to use these plugins. This kind of plugin can only be used in the editor and in standalone builds.  The web player is prevented from using them for security reasons.&lt;br /&gt;
&lt;br /&gt;
The Unity documentation outlines how native code plugins are made [http://unity3d.com/support/documentation/Manual/Plugins.html here].&lt;br /&gt;
&lt;br /&gt;
=== Cross-Platform Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie to a texture with synchronized sound.&lt;br /&gt;
&lt;br /&gt;
=== Mac OS X Only Plugins ===&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - Use AudioInput.Volume to provide microphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - Display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
*[[UniWii]] - Use Wiimotes as input devices.&lt;br /&gt;
&lt;br /&gt;
[[Category:.NET Plugins]]&lt;br /&gt;
[[Category:Native Code Plugins]]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-02-14T16:38:40Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Time tracking and GameOver broadcasting singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				Debug.LogError( &amp;quot;Attempt to access instance of MonoBehaviour singleton earlier than Start or without it being attached to a GameObject.&amp;quot; );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listeners;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listeners = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-02-13T12:26:25Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Component-based example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				Debug.LogError( &amp;quot;Attempt to access instance of MonoBehaviour singleton earlier than Start or without it being attached to a GameObject.&amp;quot; );&lt;br /&gt;
			}&lt;br /&gt;
&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-02-13T12:18:50Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Time tracking and GameOver broadcasting singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
        Init();&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-02-05T13:36:37Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Time tracking and GameOver broadcasting singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-02-05T13:35:58Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public int Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-29T13:08:59Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: Programming]]&lt;br /&gt;
[[Category: Scripting]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/AManagerClass</id>
		<title>AManagerClass</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/AManagerClass"/>
				<updated>2009-01-29T13:08:12Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Category: Concepts]]&lt;br /&gt;
[[Category: Controller]]&lt;br /&gt;
[[Category: Design Patterns]]&lt;br /&gt;
[[Category: MonoBehaviour]]&lt;br /&gt;
[[Category: C Sharp]]&lt;br /&gt;
[[Category: JavaScript]]&lt;br /&gt;
[[Category: Boo]]&lt;br /&gt;
Author: Keli Hlodversson (freyr)&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
'''Note: This article is quite dated and missing a bit of explaining. Read in conjunction with [[Singleton]].'''&lt;br /&gt;
&lt;br /&gt;
The following snippet shows how to add a static property called ''instance'' that will automatically find an instance of the class in the scene and return it.&lt;br /&gt;
&lt;br /&gt;
This is useful for managers and other behaviours that  only have one instance in the scene and need to be accessed from other classes, as it avoids having each class to keep a reference to the manager object.&lt;br /&gt;
&lt;br /&gt;
'''Hint:''' A nice place to put game managers in a scene hierarchy is to create an empty game object called ''Managers'' and attach all manager behaviours to it.&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
Use the code example as a template when creating a manager-type script. Remember to replace all occurrences of AManager with the name of your class. To access a function, say, Foo() in the manager you call (assuming the GameObject with the Manager script is named Manager) it with: &amp;lt;javascript&amp;gt;Manager.instance.Foo();&amp;lt;/javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== C# - AManager.cs ==&lt;br /&gt;
&amp;lt;csharp&amp;gt; &lt;br /&gt;
using UnityEngine;&lt;br /&gt;
 using System.Collections; &lt;br /&gt;
 &lt;br /&gt;
 /// AManager is a singleton.&lt;br /&gt;
 /// To avoid having to manually link an instance to every class that needs it, it has a static property called&lt;br /&gt;
 /// instance, so other objects that need to access it can just call:&lt;br /&gt;
 ///        AManager.instance.DoSomeThing();&lt;br /&gt;
 ///&lt;br /&gt;
 public class AManager : MonoBehaviour {&lt;br /&gt;
    // s_Instance is used to cache the instance found in the scene so we don't have to look it up every time.&lt;br /&gt;
    private static AManager s_Instance = null;&lt;br /&gt;
 &lt;br /&gt;
    // This defines a static instance property that attempts to find the manager object in the scene and&lt;br /&gt;
    // returns it to the caller.&lt;br /&gt;
    public static AManager instance {&lt;br /&gt;
        get {&lt;br /&gt;
            if (s_Instance == null) {&lt;br /&gt;
                // This is where the magic happens.&lt;br /&gt;
                //  FindObjectOfType(...) returns the first AManager object in the scene.&lt;br /&gt;
                s_Instance =  FindObjectOfType(typeof (AManager)) as AManager;&lt;br /&gt;
                if (s_Instance == null)&lt;br /&gt;
                    Debug.Log (&amp;quot;Could not locate an AManager object. \&lt;br /&gt;
                                        You have to have exactly one AManager in the scene.&amp;quot;);&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return s_Instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    // Ensure that the instance is destroyed when the game is stopped in the editor.&lt;br /&gt;
    void OnApplicationQuit() {&lt;br /&gt;
        s_Instance = null;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    // Add the rest of the code here...&lt;br /&gt;
    public void DoSomeThing() {&lt;br /&gt;
        Debug.Log(&amp;quot;Doing something now&amp;quot;, this);&lt;br /&gt;
    }&lt;br /&gt;
  &lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Boo - AManager.boo ==&lt;br /&gt;
''I haven't tested that one btw... so please fix it if you find any errors'' -- Keli&lt;br /&gt;
&amp;lt;boo&amp;gt;&lt;br /&gt;
 import UnityEngine&lt;br /&gt;
 &lt;br /&gt;
 class AManager (MonoBehaviour) :&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 AManager is a singleton.&lt;br /&gt;
 To avoid having to manually link an instance to every class that needs it, it has a static property called&lt;br /&gt;
 instance, so other objects that need to access it can just call:&lt;br /&gt;
        AManager.instance.DoSomeThing()&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
    # s_Instance is used to cache the instance found in the scene so we don't have to look it up every time.&lt;br /&gt;
    private static s_Instance as AManager&lt;br /&gt;
 &lt;br /&gt;
    #This defines a static instance property that attempts to find the manager object in the scene and&lt;br /&gt;
    # returns it to the caller.&lt;br /&gt;
    public static instance :&lt;br /&gt;
        get :&lt;br /&gt;
            if s_Instance == null :&lt;br /&gt;
                # This is where the magic happens.&lt;br /&gt;
                #  FindObjectOfType(...) returns the first AManager object in the scene.&lt;br /&gt;
                s_Instance =  FindObjectOfType(AManager) &lt;br /&gt;
                if s_Instance == null:&lt;br /&gt;
                    Debug.Log (&amp;quot;Could not locate an AManager object. \&lt;br /&gt;
                                        You have to have exactly one AManager in the scene.&amp;quot;)&lt;br /&gt;
            &lt;br /&gt;
            return s_Instance&lt;br /&gt;
    &lt;br /&gt;
    # Ensure that the instance is destroyed when the game is stopped in the editor.&lt;br /&gt;
    def OnApplicationQuit() :&lt;br /&gt;
        s_Instance = null&lt;br /&gt;
    &lt;br /&gt;
    # Add the rest of the code here...&lt;br /&gt;
    def DoSomeThing() :&lt;br /&gt;
        Debug.Log(&amp;quot;Doing something now&amp;quot;, self)&lt;br /&gt;
&amp;lt;/boo&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Javascript - AManager.js ==&lt;br /&gt;
'''Note:''' Unity Javascript does not have a way to declare properties, so the instance property has been replaced with a static variable that gets initialised upon start. This also means that one can not be sure that ''instance'' has been initialised if it is accessed during initialisation.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;javascript&amp;gt;&lt;br /&gt;
 /// AManager is a singleton.&lt;br /&gt;
 /// To avoid having to manually link an instance to every class that needs it, it has a static variabe called&lt;br /&gt;
 /// instance, so other objects that need to access it can just call:&lt;br /&gt;
 ///        AManager.instance.DoSomeThing();&lt;br /&gt;
 ///&lt;br /&gt;
 static var instance : AManager;&lt;br /&gt;
 &lt;br /&gt;
 // This is where the magic happens.&lt;br /&gt;
 //  FindObjectOfType(...) returns the first AManager object in the scene.&lt;br /&gt;
 instance =  FindObjectOfType(AManager);&lt;br /&gt;
 if (instance == null)&lt;br /&gt;
     Debug.Log (&amp;quot;Could not locate an AManager object. \&lt;br /&gt;
                     You have to have exactly one AManager in the scene.&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 // Ensure that the instance is destroyed when the game is stopped in the editor.&lt;br /&gt;
 function OnApplicationQuit() {&lt;br /&gt;
     instance = null;&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
 // Add the rest of the code here...&lt;br /&gt;
 &lt;br /&gt;
 function DoSomeThing() {&lt;br /&gt;
     Debug.Log(&amp;quot;Doing something now&amp;quot;, this);&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/javascript&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Common_Scripting_Pitfalls</id>
		<title>Common Scripting Pitfalls</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Common_Scripting_Pitfalls"/>
				<updated>2009-01-29T08:46:01Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Coroutines in C# ==&lt;br /&gt;
&lt;br /&gt;
In C#, a coroutine must return a value of type '''IEnumerator''', as mentioned in the [http://unity3d.com/Documentation/ScriptReference/index.Writing_Scripts_in_Csharp_or_Boo.html documentation].  However, if you return the similarly-named '''IEnumerable''', the coroutine won't work, and it won't return an error either!&lt;br /&gt;
&lt;br /&gt;
== Floating point variables and methods ==&lt;br /&gt;
A common thing to do in scripting is to Lerp, or linearlly interpolate between two values.  Unity has built in functions to lerp variables of type float, Vector3, Color, Material, and Quaternion, to name a few.  The key thing to get sorted out is that all of the methods that operate on these different classes are within the class itself, except for float.  To lerp a float, or to do other common operations dealing with floating point numbers, see the Mathf class.  It contains Lerp, Min, Max, Abs, Sin, and all sorts of handy math functions.  See the wiki's own [[Mathfx]] (short for Mathf eXtended) for even more handy math functions.&lt;br /&gt;
&lt;br /&gt;
== My script hangs/beachballs Unity! ==&lt;br /&gt;
The most likely cause of this is that your script enters some loop and does not give control back to the Unity engine at all.  You probably are forgetting to put a yield statement in your loop.  See the Unity documentation on [http://unity3d.com/Documentation/ScriptReference/index.Coroutines_or_the_Yield_Statement.html coroutines and the yield statement].&lt;br /&gt;
&lt;br /&gt;
Also if you hit a null reference exception, the first time it happens will take a while showing a beach ball, as the exception is also caught by Apple's crash reporter, which spends some time creating a stack trace of Unity. On slower machines this may give the impressions that Unity is hanging.&lt;br /&gt;
&lt;br /&gt;
There are more possible causes of Unity hangs that should be elaborated on later.&lt;br /&gt;
&lt;br /&gt;
== My scripts seem to be frame rate dependent! ==&lt;br /&gt;
If your script performs some incremental operation that should happen over a certain period of time, rather than a certain number of graphical updates, (This is most likely what you do not want!) you need to multiply your specific operation by [http://unity3d.com/Documentation/ScriptReference/Time-deltaTime.html Time.deltaTime].&lt;br /&gt;
&lt;br /&gt;
For example, in C#:&lt;br /&gt;
&amp;lt;csharp&amp;gt;transform.position += Vector3.up * 5f;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Should become:&lt;br /&gt;
&amp;lt;csharp&amp;gt;transform.position += Vector3.up * 5f * Time.deltaTime;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In JavaScript:&lt;br /&gt;
&amp;lt;javascript&amp;gt;transform.position += Vector3.up * 5;&amp;lt;/javascript&amp;gt;&lt;br /&gt;
Should become:&lt;br /&gt;
&amp;lt;javascript&amp;gt;transform.position += Vector3.up * 5 * Time.deltaTime;&amp;lt;/javascript&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Since Time.deltaTime is usually a very small number, you will probably need to increase the number 5f (or just 5 in JavaScript) to something larger as well.  Additionally, you should probably just make this a public variable in your script to take advantage of Unity's feature which allows you to modify variable values right in the Inspector!&lt;br /&gt;
&lt;br /&gt;
== My Editor script won't compile! ==&lt;br /&gt;
If you get an error message like ''The type namespace name `UnityEditor` could not be found: Are you missing directive or an assembly reference?'', you have saved the script in the wrong place. All scripts using the [http://unity3d.com/Documentation/ScriptReference/20_class_hierarchy.Editor_Classes.html UnityEditor namespace] must be placed in the Assets/Editor folder in your project folder.&lt;br /&gt;
&lt;br /&gt;
== I keep getting errors about my script/class types not being valid types ==&lt;br /&gt;
Make sure that the script containing the type you are trying to refer to is compiled before the script from which you try to refer it. For script compilation order, read the unity documentation on [http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html Overview: Script compilation (Advanced)].&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T14:07:24Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in [[IRC|the IRC channel]] so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:31:12Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Time tracking and GameOver broadcasting singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
Registering and unregistering would likely make sense to do in Awake and OnDisable of a script attached to the GameObjects needing it.&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:25:27Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&lt;br /&gt;
Debug.Log( &amp;quot;Score is now: &amp;quot; + MySingleton.Instance.Score );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:21:30Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking and GameOver broadcasting singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Time tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton works similarly to the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the tracked timer reaches zero or lower. The timer is set just like the score is in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int timer;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Timer&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return timer;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			timer = value;&lt;br /&gt;
			if( timer &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:19:01Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And the singleton class:&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton expands on the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the score reaches zero or lower. The score is set just like in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
			if( score &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:18:27Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton expands on the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the score reaches zero or lower. The score is set just like in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
			if( score &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:18:08Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking singleton */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score += 5;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Score tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton expands on the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the score reaches zero or lower. The score is set just like in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
			if( score &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:13:50Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Score tracking and GameOver broadcasting example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score = 5;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking and GameOver broadcasting singleton ==&lt;br /&gt;
This singleton expands on the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the score reaches zero or lower. The score is set just like in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
			if( score &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-28T13:13:21Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking singleton ==&lt;br /&gt;
The singleton in this example keeps track of the game score. Getting and setting this value is done like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Score = 5;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Score tracking and GameOver broadcasting example ==&lt;br /&gt;
This singleton expands on the score tracking singleton by also maintaining a list of GameObjects which register and unregister themselves with the singleton in order to receive a &amp;quot;GameOver&amp;quot; message when the score reaches zero or lower. The score is set just like in the singleton above and GameObjects register and unregister with the singleton like so:&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.Register( gameObject );&lt;br /&gt;
MySingleton.Instance.Unregister( gameObject );&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&amp;lt;csharp&amp;gt;using System.Collections;&lt;br /&gt;
using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
    private static MySingleton instance;&lt;br /&gt;
    &lt;br /&gt;
    public MySingleton() &lt;br /&gt;
    {&lt;br /&gt;
        if( instance != null )&lt;br /&gt;
        {&lt;br /&gt;
            Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
            return;&lt;br /&gt;
        }&lt;br /&gt;
        &lt;br /&gt;
        instance = this;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    public static MySingleton Instance&lt;br /&gt;
    {&lt;br /&gt;
        get&lt;br /&gt;
        {&lt;br /&gt;
            if( instance == null )&lt;br /&gt;
            {&lt;br /&gt;
                new MySingleton();&lt;br /&gt;
				instance.Init();&lt;br /&gt;
            }&lt;br /&gt;
            &lt;br /&gt;
            return instance;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
	private int score;&lt;br /&gt;
	private ArrayList listener;&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	private void Init()&lt;br /&gt;
	{&lt;br /&gt;
		listener = new ArrayList();&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public Score&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return score;&lt;br /&gt;
		}&lt;br /&gt;
		set&lt;br /&gt;
		{&lt;br /&gt;
			score = value;&lt;br /&gt;
			if( score &amp;lt;= 0 )&lt;br /&gt;
			{&lt;br /&gt;
				foreach( GameObject listener in listeners )&lt;br /&gt;
				{&lt;br /&gt;
					listener.SendMessage( &amp;quot;GameOver&amp;quot; );&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public GameObject RegisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		listeners.Add( listener );&lt;br /&gt;
		&lt;br /&gt;
		return listener;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	public bool UnregisterListener( GameObject listener )&lt;br /&gt;
	{&lt;br /&gt;
		if( !listeners.Contains( listener ) )&lt;br /&gt;
		{&lt;br /&gt;
			return false;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		listeners.Remove( listener );&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Singleton</id>
		<title>Singleton</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Singleton"/>
				<updated>2009-01-21T10:23:57Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: New page: By AngryAnt.  == Description ==  People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
People have recently asked about singleton creation quite often in the IRC channel so rather than retyping a basic implementation each time, I'll have this to link to. Yay! :)&lt;br /&gt;
&lt;br /&gt;
Curious, but not quite sure what a singleton is? Ask a friend: [http://en.wikipedia.org/wiki/Singleton_pattern]&lt;br /&gt;
&lt;br /&gt;
Singletons are generally handy for providing easy access to game state and control code. I've provided example implementation for a basic class type which needn't be attached to a game object in order to function and after this an implementation which works as any other component.&lt;br /&gt;
&lt;br /&gt;
Members of both singleton types are accessed the same way:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;MySingleton.Instance.MySingletonMember;&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note, however that for the component-based singleton (the second implementation), you shouldn't attempt to access the instance earlier than in Start of the calling component.&lt;br /&gt;
&lt;br /&gt;
== The non-component example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;public class MySingleton&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public MySingleton() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			if( instance == null )&lt;br /&gt;
			{&lt;br /&gt;
				new MySingleton();&lt;br /&gt;
			}&lt;br /&gt;
			&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;br /&gt;
== Component-based example ==&lt;br /&gt;
&amp;lt;csharp&amp;gt;using UnityEngine;&lt;br /&gt;
&lt;br /&gt;
public class MySingleton : MonoBehaviour&lt;br /&gt;
{&lt;br /&gt;
	private static MySingleton instance;&lt;br /&gt;
	&lt;br /&gt;
	public void Awake() &lt;br /&gt;
	{&lt;br /&gt;
		if( instance != null )&lt;br /&gt;
		{&lt;br /&gt;
			Debug.LogError( &amp;quot;Cannot have two instances of singleton. Self destruction in 3...&amp;quot; );&lt;br /&gt;
			Destroy( this );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		instance = this;&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public static MySingleton Instance&lt;br /&gt;
	{&lt;br /&gt;
		get&lt;br /&gt;
		{&lt;br /&gt;
			return instance;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
	public void OnApplicationQuit()&lt;br /&gt;
	{&lt;br /&gt;
		instance = null;&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/SelectList</id>
		<title>SelectList</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/SelectList"/>
				<updated>2008-11-10T18:01:42Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Visualises a list of strings or objects overriding ToString and returns the item selected by the user. Clicking a selected item will deselect it.&lt;br /&gt;
&lt;br /&gt;
Optionally, the OnListItemGUI delegate can be used to do custom GUI rendering of list items.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;		public static object SelectList( ICollection list, object selected, GUIStyle defaultStyle, GUIStyle selectedStyle )&lt;br /&gt;
		{			&lt;br /&gt;
			foreach( object item in list )&lt;br /&gt;
			{&lt;br /&gt;
				if( GUILayout.Button( item.ToString(), ( selected == item ) ? selectedStyle : defaultStyle ) )&lt;br /&gt;
				{&lt;br /&gt;
					if( selected == item )&lt;br /&gt;
					// Clicked an already selected item. Deselect.&lt;br /&gt;
					{&lt;br /&gt;
						selected = null;&lt;br /&gt;
					}&lt;br /&gt;
					else&lt;br /&gt;
					{&lt;br /&gt;
						selected = item;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public delegate bool OnListItemGUI( object item, bool selected, ICollection list );&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public static object SelectList( ICollection list, object selected, OnListItemGUI itemHandler )&lt;br /&gt;
		{&lt;br /&gt;
			ArrayList itemList;&lt;br /&gt;
			&lt;br /&gt;
			itemList = new ArrayList( list );&lt;br /&gt;
			&lt;br /&gt;
			foreach( object item in itemList )&lt;br /&gt;
			{&lt;br /&gt;
				if( itemHandler( item, item == selected, list ) )&lt;br /&gt;
				{&lt;br /&gt;
					selected = item;&lt;br /&gt;
				}&lt;br /&gt;
				else if( selected == item )&lt;br /&gt;
				// If we *were* selected, but aren't any more then deselect&lt;br /&gt;
				{&lt;br /&gt;
					selected = null;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	currentSeletion = SelectList( myList, currentSelection, GUI.skin.GetStyle( &amp;quot;Button&amp;quot; ), GUI.skin.GetStyle( &amp;quot;Label&amp;quot; ) );&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, myList could be an ArrayList of strings or instances of your own type, returning the desired list label in ToString.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	currentSeletion = SelectList( myList, currentSelection, OnCheckboxItemGUI );&lt;br /&gt;
&lt;br /&gt;
	private bool OnCheckboxItemGUI( object item, bool selected, ICollection list )&lt;br /&gt;
	{&lt;br /&gt;
		return GUILayout.Toggle( selected, item.ToString() );&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the same list is used, only this time it is visualised using a custom list item rendering function.&lt;br /&gt;
&lt;br /&gt;
Further advancing the use of custom list item rendering functions, you could implement nested lists similar to this:&lt;br /&gt;
&lt;br /&gt;
[[Image:SelectListNested.png]]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/File:SelectListNested.png</id>
		<title>File:SelectListNested.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/File:SelectListNested.png"/>
				<updated>2008-11-10T17:59:06Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Screenshot of how SelectList could be used to create nested select lists.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot of how SelectList could be used to create nested select lists.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/SelectList</id>
		<title>SelectList</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/SelectList"/>
				<updated>2008-11-10T17:56:05Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Usage */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Visualises a list of strings or objects overriding ToString and returns the item selected by the user. Clicking a selected item will deselect it.&lt;br /&gt;
&lt;br /&gt;
Optionally, the OnListItemGUI delegate can be used to do custom GUI rendering of list items.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;		public static object SelectList( ICollection list, object selected, GUIStyle defaultStyle, GUIStyle selectedStyle )&lt;br /&gt;
		{			&lt;br /&gt;
			foreach( object item in list )&lt;br /&gt;
			{&lt;br /&gt;
				if( GUILayout.Button( item.ToString(), ( selected == item ) ? selectedStyle : defaultStyle ) )&lt;br /&gt;
				{&lt;br /&gt;
					if( selected == item )&lt;br /&gt;
					// Clicked an already selected item. Deselect.&lt;br /&gt;
					{&lt;br /&gt;
						selected = null;&lt;br /&gt;
					}&lt;br /&gt;
					else&lt;br /&gt;
					{&lt;br /&gt;
						selected = item;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public delegate bool OnListItemGUI( object item, bool selected, ICollection list );&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public static object SelectList( ICollection list, object selected, OnListItemGUI itemHandler )&lt;br /&gt;
		{&lt;br /&gt;
			ArrayList itemList;&lt;br /&gt;
			&lt;br /&gt;
			itemList = new ArrayList( list );&lt;br /&gt;
			&lt;br /&gt;
			foreach( object item in itemList )&lt;br /&gt;
			{&lt;br /&gt;
				if( itemHandler( item, item == selected, list ) )&lt;br /&gt;
				{&lt;br /&gt;
					selected = item;&lt;br /&gt;
				}&lt;br /&gt;
				else if( selected == item )&lt;br /&gt;
				// If we *were* selected, but aren't any more then deselect&lt;br /&gt;
				{&lt;br /&gt;
					selected = null;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	currentSeletion = SelectList( myList, currentSelection, GUI.skin.GetStyle( &amp;quot;Button&amp;quot; ), GUI.skin.GetStyle( &amp;quot;Label&amp;quot; ) );&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, myList could be an ArrayList of strings or instances of your own type, returning the desired list label in ToString.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	currentSeletion = SelectList( myList, currentSelection, OnCheckboxItemGUI );&lt;br /&gt;
&lt;br /&gt;
	private bool OnCheckboxItemGUI( object item, bool selected, ICollection list )&lt;br /&gt;
	{&lt;br /&gt;
		return GUILayout.Toggle( selected, item.ToString() );&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, the same list is used, only this time it is visualised using a custom list item rendering function.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/SelectList</id>
		<title>SelectList</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/SelectList"/>
				<updated>2008-11-10T17:49:48Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Visualises a list of strings or objects overriding ToString and returns the item selected by the user. Clicking a selected item will deselect it.&lt;br /&gt;
&lt;br /&gt;
Optionally, the OnListItemGUI delegate can be used to do custom GUI rendering of list items.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;		public static object SelectList( ICollection list, object selected, GUIStyle defaultStyle, GUIStyle selectedStyle )&lt;br /&gt;
		{			&lt;br /&gt;
			foreach( object item in list )&lt;br /&gt;
			{&lt;br /&gt;
				if( GUILayout.Button( item.ToString(), ( selected == item ) ? selectedStyle : defaultStyle ) )&lt;br /&gt;
				{&lt;br /&gt;
					if( selected == item )&lt;br /&gt;
					// Clicked an already selected item. Deselect.&lt;br /&gt;
					{&lt;br /&gt;
						selected = null;&lt;br /&gt;
					}&lt;br /&gt;
					else&lt;br /&gt;
					{&lt;br /&gt;
						selected = item;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public delegate bool OnListItemGUI( object item, bool selected, ICollection list );&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public static object SelectList( ICollection list, object selected, OnListItemGUI itemHandler )&lt;br /&gt;
		{&lt;br /&gt;
			ArrayList itemList;&lt;br /&gt;
			&lt;br /&gt;
			itemList = new ArrayList( list );&lt;br /&gt;
			&lt;br /&gt;
			foreach( object item in itemList )&lt;br /&gt;
			{&lt;br /&gt;
				if( itemHandler( item, item == selected, list ) )&lt;br /&gt;
				{&lt;br /&gt;
					selected = item;&lt;br /&gt;
				}&lt;br /&gt;
				else if( selected == item )&lt;br /&gt;
				// If we *were* selected, but aren't any more then deselect&lt;br /&gt;
				{&lt;br /&gt;
					selected = null;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	currentSeletion = SelectList( myList, currentSelection, GUI.skin.GetStyle( &amp;quot;Button&amp;quot; ), GUI.skin.GetStyle( &amp;quot;Label&amp;quot; ) );&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, myList could be an ArrayList of strings or instances of your own type, returning the desired list label in ToString.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/SelectList</id>
		<title>SelectList</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/SelectList"/>
				<updated>2008-11-10T17:47:34Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Component code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Visualises a list of strings or objects overriding ToString and returns the item selected by the user.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;		public static object SelectList( ICollection list, object selected, GUIStyle defaultStyle, GUIStyle selectedStyle )&lt;br /&gt;
		{			&lt;br /&gt;
			foreach( object item in list )&lt;br /&gt;
			{&lt;br /&gt;
				if( GUILayout.Button( item.ToString(), ( selected == item ) ? selectedStyle : defaultStyle ) )&lt;br /&gt;
				{&lt;br /&gt;
					if( selected == item )&lt;br /&gt;
					// Clicked an already selected item. Deselect.&lt;br /&gt;
					{&lt;br /&gt;
						selected = null;&lt;br /&gt;
					}&lt;br /&gt;
					else&lt;br /&gt;
					{&lt;br /&gt;
						selected = item;&lt;br /&gt;
					}&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public delegate bool OnListItemGUI( object item, bool selected, ICollection list );&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		public static object SelectList( ICollection list, object selected, OnListItemGUI itemHandler )&lt;br /&gt;
		{&lt;br /&gt;
			ArrayList itemList;&lt;br /&gt;
			&lt;br /&gt;
			itemList = new ArrayList( list );&lt;br /&gt;
			&lt;br /&gt;
			foreach( object item in itemList )&lt;br /&gt;
			{&lt;br /&gt;
				if( itemHandler( item, item == selected, list ) )&lt;br /&gt;
				{&lt;br /&gt;
					selected = item;&lt;br /&gt;
				}&lt;br /&gt;
				else if( selected == item )&lt;br /&gt;
				// If we *were* selected, but aren't any more then deselect&lt;br /&gt;
				{&lt;br /&gt;
					selected = null;&lt;br /&gt;
				}&lt;br /&gt;
			}&lt;br /&gt;
		&lt;br /&gt;
			return selected;&lt;br /&gt;
		}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	currentSeletion = SelectList( myList, currentSelection, GUI.skin.GetStyle( &amp;quot;Button&amp;quot; ), GUI.skin.GetStyle( &amp;quot;Label&amp;quot; ) );&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In this example, myList could be an ArrayList of strings or instances of your own type, returning the desired list label in ToString.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Unify:Community_Portal</id>
		<title>Unify:Community Portal</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Unify:Community_Portal"/>
				<updated>2008-10-05T20:54:24Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Developers using Unity */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== What is the UnifyWiki? ==&lt;br /&gt;
&lt;br /&gt;
The UnifyWiki project is a site where you can expand your knowledge about Unity.  It is meant for anyone to contribute, so if you know something we don't, go ahead and make a page about it.  Learn more about how [http://meta.wikimedia.org/wiki/MediaWiki_User's_Guide here]. Make sure you read [[:Help:Contents|this]] as well.&lt;br /&gt;
&lt;br /&gt;
== Links ==&lt;br /&gt;
&lt;br /&gt;
=== Unity Technologies ===&lt;br /&gt;
*[http://unity3d.com/ Unity Technologies]&lt;br /&gt;
*[http://forum.unity3d.com/ Forum]&lt;br /&gt;
&lt;br /&gt;
=== Community sites ===&lt;br /&gt;
*[http://unify.bluegillweb.com/ Unify Unity collaboration community]&lt;br /&gt;
*[http://unify.bluegillweb.com/unitree/ UniTree]&lt;br /&gt;
*The [irc://irc.freenode.net/unity3d #unity3d] IRC channel at freenode.  ''[[IRC|(What is IRC?)]]''&lt;br /&gt;
&lt;br /&gt;
=== Developers using Unity ===&lt;br /&gt;
*[http://angryant.com AngryAnt.com] - AI solutions for unity&lt;br /&gt;
*[http://www.bluegillflame.com/ BlueGill Flame]  - Formerly known as BlueGill Studios&lt;br /&gt;
*[http://www.graveck.com/ Graveck Interactive] - Aarku and co.&lt;br /&gt;
*[http://www.nether.org.uk/ Neil Carter]&lt;br /&gt;
*[http://seriousgames.dk Serious Games Interactive] - Unity Technologies' sister company&lt;br /&gt;
*[http://www.widgetmonkeys.com Widget Monkeys] - Seriously simple fun&lt;br /&gt;
*[http://www.eduweb.com/ Educational Web Adventures] - Producers of [http://www.wolfquest.org/ WolfQuest]&lt;br /&gt;
*[http://www.bydesigngames.com/ ByDesign Games - Joe Schultz] Freshness Guaranteed!&lt;br /&gt;
*[http://www.vrshell.com/ VRshell Games] - Developer of VR simulations on Mac.&lt;br /&gt;
*[http://games.sector3.com.au/ Sector3 Games] - Awesome 3D games for Mac &amp;amp; PC&lt;br /&gt;
&lt;br /&gt;
=== Publishers ===&lt;br /&gt;
*[http://www.ambrosiasw.com/ Ambrosia] - publisher of OTEE's [http://www.AmbrosiaSW.com/games/gooball/ Gooball].&lt;br /&gt;
*[http://www.freeverse.com/ Freeverse] - publisher of a lot of great Mac games of all shapes and sizes and supporters of [http://www.freeverse.com/omg/ Original Mac Games].&lt;br /&gt;
&lt;br /&gt;
=== Content that can be licensed and used ===&lt;br /&gt;
*[http://www.arteria-gaming.com/ Arteria Gaming] - Many packs available via &amp;quot;all-you-can-eat&amp;quot; yearly subscriptions&lt;br /&gt;
*[http://www.cubixstudio.com/ Cubix Studio] - Human and weapon models for under $20.&lt;br /&gt;
&lt;br /&gt;
=== Other ===&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Unity_game_engine Unity entry on Wikipedia]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/FileBrowser</id>
		<title>FileBrowser</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/FileBrowser"/>
				<updated>2008-10-02T21:12:11Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Description */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Implements a crude file browser in unity 2.0 GUI. This code uses the [[SelectList]] script.&lt;br /&gt;
&lt;br /&gt;
Note that by crude I mean you might want to have a GUILayout pretty it up and at some point someone (me perhaps?) should pull the script around a bit so the file and directory representations in the lists aren't by complete path. Also the root check only works for unix environments at the moment. That should be an easy rewrite though.&lt;br /&gt;
&lt;br /&gt;
This is how the browser could look:&lt;br /&gt;
&lt;br /&gt;
[[Image:FileBrowser.png]]&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;public static bool FileBrowser( ref string location, ref Vector2 directoryScroll, ref Vector2 fileScroll )&lt;br /&gt;
{&lt;br /&gt;
    bool complete;&lt;br /&gt;
    DirectoryInfo directoryInfo;&lt;br /&gt;
    DirectoryInfo directorySelection;&lt;br /&gt;
    FileInfo fileSelection;&lt;br /&gt;
    int contentWidth;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // Our return state - altered by the &amp;quot;Select&amp;quot; button&lt;br /&gt;
    complete = false;&lt;br /&gt;
    &lt;br /&gt;
    // Get the directory info of the current location&lt;br /&gt;
    fileSelection = new FileInfo( location );&lt;br /&gt;
    if( fileSelection.Attributes == FileAttributes.Directory )&lt;br /&gt;
    {&lt;br /&gt;
    	directoryInfo = new DirectoryInfo( location );&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
    	directoryInfo = fileSelection.Directory;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    if( location != &amp;quot;/&amp;quot; &amp;amp;&amp;amp; GUI.Button( new Rect( 10, 20, 410, 20 ), &amp;quot;Up one level&amp;quot; ) )&lt;br /&gt;
    {&lt;br /&gt;
        directoryInfo = directoryInfo.Parent;&lt;br /&gt;
        location = directoryInfo.FullName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    // Handle the directories list&lt;br /&gt;
    GUILayout.BeginArea( new Rect( 10, 40, 200, 300 ) );&lt;br /&gt;
        GUILayout.Label( &amp;quot;Directories:&amp;quot; );&lt;br /&gt;
        directoryScroll = GUILayout.BeginScrollView( directoryScroll );&lt;br /&gt;
    	    directorySelection = BehaveLibrary.Resources.SelectList( directoryInfo.GetDirectories(), null ) as DirectoryInfo;&lt;br /&gt;
    	GUILayout.EndScrollView();&lt;br /&gt;
    GUILayout.EndArea();&lt;br /&gt;
    &lt;br /&gt;
    if( directorySelection != null )&lt;br /&gt;
    // If a directory was selected, jump there&lt;br /&gt;
    {&lt;br /&gt;
        location = directorySelection.FullName;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // Handle the files list&lt;br /&gt;
    GUILayout.BeginArea( new Rect( 220, 40, 200, 300 ) );&lt;br /&gt;
        GUILayout.Label( &amp;quot;Files:&amp;quot; );&lt;br /&gt;
        fileScroll = GUILayout.BeginScrollView( fileScroll );&lt;br /&gt;
        	fileSelection = BehaveLibrary.Resources.SelectList( directoryInfo.GetFiles(), null ) as FileInfo;&lt;br /&gt;
    	GUILayout.EndScrollView();&lt;br /&gt;
    GUILayout.EndArea();&lt;br /&gt;
    &lt;br /&gt;
    if( fileSelection != null )&lt;br /&gt;
    // If a file was selected, update our location to it&lt;br /&gt;
    {&lt;br /&gt;
        location = fileSelection.FullName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // The manual location box and the select button&lt;br /&gt;
    GUILayout.BeginArea( new Rect( 10, 350, 410, 20 ) );&lt;br /&gt;
    GUILayout.BeginHorizontal();		&lt;br /&gt;
    	location = GUILayout.TextArea( location );&lt;br /&gt;
&lt;br /&gt;
    	contentWidth = ( int )GUI.skin.GetStyle( &amp;quot;Button&amp;quot; ).CalcSize( new GUIContent( &amp;quot;Select&amp;quot; ) ).x;&lt;br /&gt;
    	if( GUILayout.Button( &amp;quot;Select&amp;quot;, GUILayout.Width( contentWidth ) ) )&lt;br /&gt;
    	{&lt;br /&gt;
    		complete = true;&lt;br /&gt;
    	}&lt;br /&gt;
    GUILayout.EndHorizontal();&lt;br /&gt;
    GUILayout.EndArea();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    return complete;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	public void FileBrowserWindow( int idx )&lt;br /&gt;
	{&lt;br /&gt;
		if( FileBrowser( ref location, ref directoryScroll, ref fileScroll ) )&lt;br /&gt;
		{&lt;br /&gt;
			fileBrowser = false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void OnGUI()&lt;br /&gt;
	{&lt;br /&gt;
		if( fileBrowser )&lt;br /&gt;
		{&lt;br /&gt;
			GUI.Window( 0, new Rect( ( Screen.width - 430 ) / 2, ( Screen.height - 380 ) / 2, 430, 380 ), FileBrowserWindow, &amp;quot;Browse&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/File:FileBrowser.png</id>
		<title>File:FileBrowser.png</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/File:FileBrowser.png"/>
				<updated>2008-10-02T21:10:54Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: Screenshot of how the FileBrowser script could look.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Screenshot of how the FileBrowser script could look.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Scripts</id>
		<title>Scripts</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Scripts"/>
				<updated>2008-10-02T21:03:48Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Unity 2.0 GUI Scripts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
= General =&lt;br /&gt;
&lt;br /&gt;
== General Concepts ==&lt;br /&gt;
&lt;br /&gt;
*[[AManagerClass]] - How to add easy access to a singleton class in a scene.&lt;br /&gt;
*[[BasicDataStructures]] - Discussion of the use of the data-structures available in Unity.&lt;br /&gt;
*[[SimpleRegex]] - How one might use regular expressions in Unity.&lt;br /&gt;
*[[ToggleGravity]] - How to toggle a property, in this case the global gravity setting, by the left mouse button.&lt;br /&gt;
&lt;br /&gt;
== Utility Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[Angle]] - Helper class to work with angles.&lt;br /&gt;
*[[CustomRandom]] - C# Random number generator, when you must have a random number generator that works the same way on all platforms!&lt;br /&gt;
*[[deepSearch]] - Searches recursively from the parent down.&lt;br /&gt;
*[[ExpandoObject]] - Create ECMAScript-style expando objects in Unity Javascript.&lt;br /&gt;
*[[HexConverter]] - Functions for converting decimal colors to hexadecimal... and back.&lt;br /&gt;
*[[HSBColor]] - This utility script provides a HSB color model in addition to Unity's built in RGB Color class.&lt;br /&gt;
*[[LABColor]] - This utility script provides an LAB color model in addition to Unity's built in RGB Color class.&lt;br /&gt;
*[[Layers]] - A utility script for holding easily-accessible layers and easily creating masks.&lt;br /&gt;
*[[Mathfx]] - This script contains a growing number of small and useful math functions (short for Mathf eXtended).&lt;br /&gt;
*[[Matrix]] - A class for doing 3D matrix math against Vector3 objects.&lt;br /&gt;
*[[MazeGenerator]] - Randomly generates a maze.&lt;br /&gt;
*[[MD5]] - Generate an MD5 hash for a string.&lt;br /&gt;
*[[MetadataSystem]] - Mechanism for ciphered, compressed preferences and declarative metadata system with runtime overrides.&lt;br /&gt;
*[[MixupGO]] - Flatten GameObjects and all attached components into a single object using duck typing  in Unity Javascript.&lt;br /&gt;
*[[ObjExporter]] - A simple utility class for exporting a mesh to an obj file.&lt;br /&gt;
*[[PrintPolyCount]] - Prints total vertex and triangle count in the object hierarchy.&lt;br /&gt;
*[[Set]] - A set data structure.&lt;br /&gt;
*[[Shell]] - A replacement for the built-in shell function removed from Unity 1.6.1.&lt;br /&gt;
*[[StringToValue]] - Functions for finding data within a string.&lt;br /&gt;
*[[StringUtil]] - Word wrap and line count functions.&lt;br /&gt;
*[[TerrainObjExporter]] - Export Unity 2.0 Terrain objects as obj files.&lt;br /&gt;
*[[TextScanner]] - A utility class for parsing strings using std C sscanf format strings.&lt;br /&gt;
*[[VertexInfo]] - Displays the vertex numbers of a mesh at the runtime.&lt;br /&gt;
&lt;br /&gt;
== Really Simple Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[ConstantVelocity]] - Set a local velocity to an object (useful for missiles perhaps?)&lt;br /&gt;
*[[OnCollideExplode]] - Spawn a prefab (explosion) on collision, and remove the GameObject from the game.&lt;br /&gt;
*[[OnCollideSound]] - Spawn a prefab (preferably a sound) if a collision is over a certain magnitude.&lt;br /&gt;
*[[OnExplosionEffect]] - Give an explosive effect over an area.&lt;br /&gt;
*[[SwitchCamera]] - Switches between cameras in your scene.&lt;br /&gt;
*[[PointerManager]] - Hides the mouse pointer when it is not in use.&lt;br /&gt;
&lt;br /&gt;
== Code Snippets ==&lt;br /&gt;
&lt;br /&gt;
*[[Calculating Lead For Projectiles]] - These script fragments allow you to add some lead ahead of the target allowing projectiles/missiles to collide with the target.  Uses a quadratic rather than an iterative solution.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Controllers =&lt;br /&gt;
&lt;br /&gt;
== Camera Controls == &lt;br /&gt;
&lt;br /&gt;
*[[CrossFade]] - Smoothly fade the view from one camera to another.&lt;br /&gt;
*[[CrossFadePro]] - Smoothly fade the view from one camera to another, with motion in both cameras.&lt;br /&gt;
*[[DreamWipe]] - Fade the view from one camera to another, with the wavy distortion seen with dream sequences or flashbacks&lt;br /&gt;
*[[FadeInOut]] - Fade a full-screen image in or out, good for fade in outs.&lt;br /&gt;
*[[Headbobber]] - Make an object bob up and down smoothly when you're pressing one or both of the horizontal/vertical axes.&lt;br /&gt;
*[[MouseLookPlus]] - A javascript mouselook with key control. based on the standard assets C# mouselook.&lt;br /&gt;
*[[RectangleWipe]] - Make an animated rectangular zooming screen wipe from one camera to another.&lt;br /&gt;
*[[ShapeWipe]] - Make an animated screen wipe, where an arbitrary shape containing the second view zooms in or out, and rotates.&lt;br /&gt;
*[[SmoothFollow2]] - This is designed to make a camera smoothly follow a ship in space.&lt;br /&gt;
*[[SquishWipe]] - Make an animated screen wipe from one camera to another, where the first image is squished out of view.&lt;br /&gt;
&lt;br /&gt;
== Character Controller Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[Force2D]] - Constrain a GameObject to move in two dimensions.&lt;br /&gt;
*[[PhysicsFPSWalker]] - Another physics based fps walker script.&lt;br /&gt;
*[[RigidbodyFPSWalker]] - An physics based FPS walker that works with rigidbodies and thus is affected by forces, joints or other rigidbodies&lt;br /&gt;
*[[ShipControls]] - Place this script on a [http://www.otee.dk/Documentation/ScriptReference/Rigidbody.html RigidBody] for 2D spaceship controls like [http://otee.dk/gallery/udwc/OverWhelmedArena.html OverWhelmed Arena].&lt;br /&gt;
*[[VariableSpeedFPSwalker]] - An FPS walker script having different speeds for walking forward, strafing, and back-pedalling.&lt;br /&gt;
*[[JCar]] - A car using wheel colliders.&lt;br /&gt;
&lt;br /&gt;
== Animation Controllers ==&lt;br /&gt;
&lt;br /&gt;
*[[AniMate]] - Script to quickly and easily create animations/tweens of almost any value and including eased, rigidbody and rotation animation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= GUI =&lt;br /&gt;
&lt;br /&gt;
== Graphical User Interface Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[AutoType]] - Automaticly types a string of text typewriter style.&lt;br /&gt;
*[[Box_Script]] - Use this system to easily make simple GUI elements in nice looking boxes with buttons that actually do something useful. All generated at runtime from a MenuStyle.&lt;br /&gt;
*[[Button]] - Use this script on a guiTexture object for regular push buttons that send a message when clicked.&lt;br /&gt;
*[[Custom_2D_Pointer]] - Make a custom pointer that changes shape at the edges of the screen.&lt;br /&gt;
*[[DraggableGUIElement]] - Click and drag on GUITexture or GUIText to move it around the screen.&lt;br /&gt;
*[[DragSlider]] - Use this script with a pair of [http://otee.dk/Documentation/ScriptReference/GUITexture.html GUITexture]s to make a functioning slider.&lt;br /&gt;
*[[FadeIn]] - Allows you to show/hide a [http://www.otee.dk/Documentation/ScriptReference/GUIText.html GUIText] or [http://www.otee.dk/Documentation/ScriptReference/GUITexture.html GUITexture] when pressing a key/button.&lt;br /&gt;
*[[ForwardAllMouseEvents]] - Send mouse events to some sort of controller type GameObject.&lt;br /&gt;
*[[GetTimeString]] - A simple function that can be placed anywhere and used to display times. Useful for racing games.&lt;br /&gt;
*[[GUIBuilder]] - Generic classes for easing the pain of GUI creation. (BETA)&lt;br /&gt;
*[[GUIFly]] - Use this script on an object to make it respond to a &amp;quot;Fly&amp;quot; message so that it may move on and off the screen in a pleasing manner.&lt;br /&gt;
*[[GuiRatioFixer]] - Use on a [http://otee.dk/Documentation/ScriptReference/GUIText.html GUIText] /[http://otee.dk/Documentation/ScriptReference/GUITexture.html GUITexture]  object to automatically adjust aspect ratio&lt;br /&gt;
*[[GuiRatioFixer2]] - Alternate script based on screen's aspect to use on a [http://otee.dk/Documentation/ScriptReference/GUIText.html GUIText] /[http://otee.dk/Documentation/ScriptReference/GUITexture.html GUITexture] object to automatically adjust aspect ratio&lt;br /&gt;
*[[ScreenShotMovie]] - Captures a screenshot sequence for use when making a movie&lt;br /&gt;
*[[TakeScreenshot]] - Captures sequentially numbered screenshots when a function key is pressed.&lt;br /&gt;
*[[ToggleButton]] - Extends the Button class to create a toggle button.&lt;br /&gt;
&lt;br /&gt;
== Unity 2.0 GUI Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[Blinking Text Entry Cursor]] - Make your cursor blink on input fields&lt;br /&gt;
*[[FileBrowser]] - Implement a crude file browser.&lt;br /&gt;
*[[CustomGetMouseButtonDown]] - custom wrapper functions for Input.GetMouseButton(Down) which can be modified to block clicks when over a window&lt;br /&gt;
*[[Position To Rect]] - Convert a GUITexture position to Rect (GUI coordinates)&lt;br /&gt;
*[[GUICam]] - Holds GUIRect a rectanle of camera pixelRect in GUI oriented co-oridinates (0,0) is top left&lt;br /&gt;
*[[GUIx]] - extended GUI functions&lt;br /&gt;
*[[PasswordField]] - Allows the user to type in a field masked by *'s (or any other character)&lt;br /&gt;
*[[PauseMenu]] - Standard pause menu used by Fugu Games for web players and widgets&lt;br /&gt;
*[[SelectList]] - A list of elements of which one can be selected.&lt;br /&gt;
*[[WithPrefs]] - Functions that change values and modifies preferences in one simple step&lt;br /&gt;
&lt;br /&gt;
== Heads Up Display Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[FramesPerSecond]] - Use this script on a [http://unity3d.com/Documentation/Components/class-GuiText.html GUIText] object to display FPS counter.&lt;br /&gt;
*[[MessageDisplayer]] - Use this script on a [http://unity3d.com/Documentation/Components/class-GuiText.html GUIText] object to have a self-disappearing list of status messages.&lt;br /&gt;
*[[Radar]] - Use this script on a GameObject to display a radar.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Effects =&lt;br /&gt;
&lt;br /&gt;
== General Purpose Effect Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[Animating Tiled texture]] - A texture made of many tiles animated through setting the uv offsets&lt;br /&gt;
*[[Animating Tiled texture - Extended]] - Use one animation cell-sheet texture for many animations and skins.&lt;br /&gt;
*[[CameraFacingBillboard]] - Use this script on a billboard or similar object to make it align itself with the camera.&lt;br /&gt;
*[[CameraRenderSettings]] - Allows storing seperate render settings per camera - an extended version of the Fog Layer script above.&lt;br /&gt;
*[[Character Shadow]] - Cast shadows from an object! ''(requires Unity Pro)''&lt;br /&gt;
*[[Flocking]] - A flocking script with randomness and target following.&lt;br /&gt;
*[[Fog Layer]] - Lets you determine per camera if fog should be enabled or disabled&lt;br /&gt;
*[[LookAtCameraYonly]] - Use this script on a billboard or other object to have it face the camera but only rotate on the Y axis.&lt;br /&gt;
*[[MeshMorpher]] - A Mesh Morpher script with scripting API&lt;br /&gt;
*[[MetaBalls]] - 3D Metaballs&lt;br /&gt;
*[[OptimizedTrailRenderer]] - Started from Yoggy's trail renderer above, this one updates every frame and is built for one-time use.&lt;br /&gt;
*[[Perlin Noise]] - Noise functions for smoothly moving objects around or anything else&lt;br /&gt;
*[[ReverseNormals]] - Reverses normals &amp;amp; back face culling of a mesh&lt;br /&gt;
*[[Shadow Volumes in Alpha]] - Shadow volume based shadows ''(requires Unity Pro)''&lt;br /&gt;
*[[SoftBodies]] - Cloth, Springy Noodles, Jello Blocks, etc..&lt;br /&gt;
*[[StopEmittingAfterDelay]] - After a configurable delay, particles will fade naturally, then finally the object will get destroyed with autodestruct.&lt;br /&gt;
*[[Spline Controller]] - Interpolates any GameObject along a user-defined spline&lt;br /&gt;
*[[SVG]] - Render SVG Files.&lt;br /&gt;
*[[TubeRenderer]] - LineRenderer too flat? Make it a tube instead.&lt;br /&gt;
*[[TimeBasedTrailRenderer]] - The Built in trail renderer does not fade its segments based on the time they have been alive. This one does.&lt;br /&gt;
*[[Trail Arc Renderer]] - Designed for melee trail swings, this creates a trail using Catmull-Rom spline interpolation&lt;br /&gt;
&lt;br /&gt;
== Image Postprocessing Effects ==&lt;br /&gt;
&lt;br /&gt;
These scripts require Unity Pro.&lt;br /&gt;
&lt;br /&gt;
*[[BloomEffect]] (OBSOLETE) - Sometimes referred to as &amp;quot;glow&amp;quot;, use this effect to make bright parts in your scene bleed.  This script is made obsolete by the GlowEffect shipped with Unity 1.5.&lt;br /&gt;
*[[BoostColors]] - A very simple and fast way to boost the contrast of saturation of the graphics in your game.&lt;br /&gt;
*[[InvertCamera]] - A simple script that will invert everything rendered by a camera.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Physics / Simulation =&lt;br /&gt;
&lt;br /&gt;
== Physics Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[DontGoThroughThings]] - Script that uses raycasting to avoid fast-moving objects going through obstructions.&lt;br /&gt;
*[[ComplicatedRigidbodyControl]] - Attach a rigidbody to an arbitrary transform, or a method to make rigidbodies never overshoot.&lt;br /&gt;
&lt;br /&gt;
== Simulation Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[Compass]] - This script simulates a compass with North relative to the Z axis of a reference object&lt;br /&gt;
*[[GameTime]] - This script rotates a directional light to match the rotation of the sun based on the system time.&lt;br /&gt;
*[[GPS Global Positioning System]] - This script simulates a GPS device providing real world GPS locations based on a reference point&lt;br /&gt;
*[[Gravity]] - Simulates body-to-body gravity (i.e. planetary gravity)&lt;br /&gt;
*[[IMU Inertial Measurement Unit]] - This script simulates an IMU providing velocities and accelerations of the object it is attached to in the objects local frame.&lt;br /&gt;
*[[SICK Laser Scanner]] - This script simulates the SICK LMS type planar laser scanner&lt;br /&gt;
*[[Trajectory Simulation]] - Demonstrates simulating the trajectory of a launched object&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Networking =&lt;br /&gt;
&lt;br /&gt;
== WWW Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[CookieCutter]] - Access browser cookies from Unity web players.&lt;br /&gt;
*[[GetXMLHack]] - Get XML data into the web player using browser script instead of WWW() (which has been buggy for me!)&lt;br /&gt;
*[[MeshSerializer]] - Save Unity meshes to files for the Web, load them with WWW interface.&lt;br /&gt;
*[[PlayerPrefsx]] - ( '''Now obsolete in Unity 2.1''') An extension to CookieCutter which allows you to save data in both standalones and cookies for the web without having to think about it.&lt;br /&gt;
*[[Server Side Highscores]] - A complete tutorial for implementing a server side php script for storing high scores and how to post the scores to the server.&lt;br /&gt;
*[[UnityObject]] - A nice &amp;amp; clean way to embed .unityweb in your web browser. Plugin Detection, Communication, Clean HTML&lt;br /&gt;
*[[VersionCheck]] - A very basic version checker. This can be used to check if the version of the game the user is running is the latest, and if not, send them to a URL to download the latest.&lt;br /&gt;
&lt;br /&gt;
== Unity 1.x Networking Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[NetworkCursor]] - Serverless realtime networking. An example where one Unity instance controls another via a TCP/IP socket. Could be expanded to do many types of realtime networking.&lt;br /&gt;
*[[Sender]] - Uses a Server to send data from the parent object to whatever is on the other end of the connection.&lt;br /&gt;
*[[Server]] - TCP network host, based on NetworkCursor, but expanded to do more.&lt;br /&gt;
*[[Simple TCP/IP Client - Server]] - This contains source code for C# that you can use to create a server for Windows and a DLL in C# that you can use with Unity&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Sound =&lt;br /&gt;
&lt;br /&gt;
*[[JukeboxController]] - A very basic jukebox class. This can be used to manage multiple audio clips across different levels.&lt;br /&gt;
*[[Loudness]] - A simple improvement for volume control.&lt;br /&gt;
*[[SmoothAudioLoop]] - Allows for audio files with extended &amp;quot;tails&amp;quot; to be looped.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Development =&lt;br /&gt;
&lt;br /&gt;
== Debugging Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[DetectLeaks]] - a simple GUI script for displaying the amount of objects currently loaded by type&lt;br /&gt;
*[[DebugConsole]] - A script to allow scrolling feedback from your scripts.&lt;br /&gt;
*[[DebuggerX]] - A simple javascript singleton that allows you to send debug to the console or the GUI&lt;br /&gt;
*[[Reporter]] - a simple delayed action system info script that could be used for support purposes&lt;br /&gt;
*[[UUnit]] - a Simple xUnit framework that can be run inside Unity.&lt;br /&gt;
&lt;br /&gt;
== Performance Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[StaticPerformanceOptimization]] - A script that optimizes performance statically based on the users graphics card by dropping terrain resolution and quality settings&lt;br /&gt;
&lt;br /&gt;
== Editor Scripts ==&lt;br /&gt;
&lt;br /&gt;
*[[AddChild]] - Adds an empty GameObject as a child of each selected object.&lt;br /&gt;
*[[AddComponentRecursively]] - Adds a component to an object, and all the children of that object.&lt;br /&gt;
*[[CopyTransform]] - Copies the local transform of the selected game instance in the scene and then pastes it into another one you select.&lt;br /&gt;
*[[DeleteComponentsInChildren]] - Helps to delete a special type of components which are attached to the children of the selected Gameobject.&lt;br /&gt;
*[[FindObjects]] - Find objects by name or attached component type.&lt;br /&gt;
*[[GetSize]] - Get the size in game units of a selection.&lt;br /&gt;
*[[HeightmapFromTexture]] - Applies a selected texture as a heightmap to the active terrain.&lt;br /&gt;
*[[InsertParent]] - An alternative to the built-in Make Parent command, this script inserts a new GameObject which becomes the parent of all selected objects.&lt;br /&gt;
*[[Notes]] - Allows you to add notes to any GameObject.&lt;br /&gt;
*[[PixelLightMapper]] - A pixel based light mapper for Unity&lt;br /&gt;
*[[Skybox Generator]] - Generates the 6 images necessary to create a Skybox in Unity.&lt;br /&gt;
*[[SnapToGrid]] - Snaps objects to a grid in 3 dimensions.&lt;br /&gt;
*[[Take3DScreenshot]] - Take a &amp;quot;3d screenshot&amp;quot;; a series of screenshots captured while rotating around a given object. Useful for QTVR creation. &lt;br /&gt;
*[[ToggleActiveRecursively]] - Activates/deactivates entire hierarchies at once.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= External Links =&lt;br /&gt;
&lt;br /&gt;
*[http://code.google.com/p/opensteerdotnet/ opensteer .NET]&lt;br /&gt;
*[http://ctrl-j.com.au/pages/jcarsrc.html Ctrl-J Sample Projects (wheel collider car and other stuff)]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/FileBrowser</id>
		<title>FileBrowser</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/FileBrowser"/>
				<updated>2008-10-02T21:01:55Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: New page: By AngryAnt.  == Description ==  Implements a crude file browser in unity 2.0 GUI. This code uses the SelectList script.  == Component code ==  &amp;lt;csharp&amp;gt;public static bool FileBrowser( ...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;By AngryAnt.&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
Implements a crude file browser in unity 2.0 GUI. This code uses the [[SelectList]] script.&lt;br /&gt;
&lt;br /&gt;
== Component code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;public static bool FileBrowser( ref string location, ref Vector2 directoryScroll, ref Vector2 fileScroll )&lt;br /&gt;
{&lt;br /&gt;
    bool complete;&lt;br /&gt;
    DirectoryInfo directoryInfo;&lt;br /&gt;
    DirectoryInfo directorySelection;&lt;br /&gt;
    FileInfo fileSelection;&lt;br /&gt;
    int contentWidth;&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // Our return state - altered by the &amp;quot;Select&amp;quot; button&lt;br /&gt;
    complete = false;&lt;br /&gt;
    &lt;br /&gt;
    // Get the directory info of the current location&lt;br /&gt;
    fileSelection = new FileInfo( location );&lt;br /&gt;
    if( fileSelection.Attributes == FileAttributes.Directory )&lt;br /&gt;
    {&lt;br /&gt;
    	directoryInfo = new DirectoryInfo( location );&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
    	directoryInfo = fileSelection.Directory;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
&lt;br /&gt;
    if( location != &amp;quot;/&amp;quot; &amp;amp;&amp;amp; GUI.Button( new Rect( 10, 20, 410, 20 ), &amp;quot;Up one level&amp;quot; ) )&lt;br /&gt;
    {&lt;br /&gt;
        directoryInfo = directoryInfo.Parent;&lt;br /&gt;
        location = directoryInfo.FullName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    &lt;br /&gt;
    // Handle the directories list&lt;br /&gt;
    GUILayout.BeginArea( new Rect( 10, 40, 200, 300 ) );&lt;br /&gt;
        GUILayout.Label( &amp;quot;Directories:&amp;quot; );&lt;br /&gt;
        directoryScroll = GUILayout.BeginScrollView( directoryScroll );&lt;br /&gt;
    	    directorySelection = BehaveLibrary.Resources.SelectList( directoryInfo.GetDirectories(), null ) as DirectoryInfo;&lt;br /&gt;
    	GUILayout.EndScrollView();&lt;br /&gt;
    GUILayout.EndArea();&lt;br /&gt;
    &lt;br /&gt;
    if( directorySelection != null )&lt;br /&gt;
    // If a directory was selected, jump there&lt;br /&gt;
    {&lt;br /&gt;
        location = directorySelection.FullName;&lt;br /&gt;
    }&lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
    // Handle the files list&lt;br /&gt;
    GUILayout.BeginArea( new Rect( 220, 40, 200, 300 ) );&lt;br /&gt;
        GUILayout.Label( &amp;quot;Files:&amp;quot; );&lt;br /&gt;
        fileScroll = GUILayout.BeginScrollView( fileScroll );&lt;br /&gt;
        	fileSelection = BehaveLibrary.Resources.SelectList( directoryInfo.GetFiles(), null ) as FileInfo;&lt;br /&gt;
    	GUILayout.EndScrollView();&lt;br /&gt;
    GUILayout.EndArea();&lt;br /&gt;
    &lt;br /&gt;
    if( fileSelection != null )&lt;br /&gt;
    // If a file was selected, update our location to it&lt;br /&gt;
    {&lt;br /&gt;
        location = fileSelection.FullName;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    // The manual location box and the select button&lt;br /&gt;
    GUILayout.BeginArea( new Rect( 10, 350, 410, 20 ) );&lt;br /&gt;
    GUILayout.BeginHorizontal();		&lt;br /&gt;
    	location = GUILayout.TextArea( location );&lt;br /&gt;
&lt;br /&gt;
    	contentWidth = ( int )GUI.skin.GetStyle( &amp;quot;Button&amp;quot; ).CalcSize( new GUIContent( &amp;quot;Select&amp;quot; ) ).x;&lt;br /&gt;
    	if( GUILayout.Button( &amp;quot;Select&amp;quot;, GUILayout.Width( contentWidth ) ) )&lt;br /&gt;
    	{&lt;br /&gt;
    		complete = true;&lt;br /&gt;
    	}&lt;br /&gt;
    GUILayout.EndHorizontal();&lt;br /&gt;
    GUILayout.EndArea();&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    return complete;&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Usage ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;csharp&amp;gt;	public void FileBrowserWindow( int idx )&lt;br /&gt;
	{&lt;br /&gt;
		if( FileBrowser( ref location, ref directoryScroll, ref fileScroll ) )&lt;br /&gt;
		{&lt;br /&gt;
			fileBrowser = false;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	public void OnGUI()&lt;br /&gt;
	{&lt;br /&gt;
		if( fileBrowser )&lt;br /&gt;
		{&lt;br /&gt;
			GUI.Window( 0, new Rect( ( Screen.width - 430 ) / 2, ( Screen.height - 380 ) / 2, 430, 380 ), FileBrowserWindow, &amp;quot;Browse&amp;quot; );&lt;br /&gt;
			return;&lt;br /&gt;
		}&lt;br /&gt;
	}&lt;br /&gt;
&amp;lt;/csharp&amp;gt;&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2008-10-02T10:19:49Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* .NET Plugins */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
  | __TOC__&lt;br /&gt;
  |}&lt;br /&gt;
&lt;br /&gt;
These extensions, or ''plugins'', allow you to add special features to your unity projects without the hassle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== .NET Plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins are simply DLLs which have been built from Mono/.NET source code. When your project is built, they are merged with the compiled Mono code from your project's scripts. This means that you can use them with a Unity Indie licence as well as with Pro and in web players.&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path.html Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave.html Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-and-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
No entries yet.&lt;br /&gt;
&lt;br /&gt;
== Native Code Plugins ==&lt;br /&gt;
&lt;br /&gt;
Native code plugins can be written in many languages, including C and C++. A Unity Pro licence is required to use these plugins. This kind of plugin can only be used in the editor and in standalone builds.  The web player is prevented from using them for security reasons.&lt;br /&gt;
&lt;br /&gt;
The Unity documentation outlines how native code plugins are made [http://unity3d.com/support/documentation/Manual/Plugins.html here].&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie to a texture with synchronized sound.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - Use AudioInput.Volume to provide microphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - Display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
*[[UniWii]] - Use Wiimotes as input devices.&lt;br /&gt;
&lt;br /&gt;
[[Category:.NET Plugins]]&lt;br /&gt;
[[Category:Native Code Plugins]]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/User:AngryAnt</id>
		<title>User:AngryAnt</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/User:AngryAnt"/>
				<updated>2008-10-01T18:01:46Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: New page: [http://angryant.com AngryAnt.com]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[http://angryant.com AngryAnt.com]&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Main_Page"/>
				<updated>2008-10-01T17:32:54Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: /* Main Sections */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Image:Splash.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Support UnifyWiki ==&lt;br /&gt;
[http://www.dreamhost.com/donate.cgi?id=9231 Donate towards hosting of this wiki!]&lt;br /&gt;
== Welcome to the UnifyWiki ==&lt;br /&gt;
&lt;br /&gt;
The UnifyWiki is part of the [http://unifycommunity.com Unify Community] experience and is a place to find and share [http://otee.dk/unity Unity] knowledge. Special thanks to [[User:Aarku|Aarku]], [[User:Dho|Dho]], [[User:NCarter|NCarter]], [[User:KeliHlodversson|Freyr]], [[User:Outcast|Outcast]] and others.&lt;br /&gt;
&lt;br /&gt;
We're currently working on [[Special:Statistics|{{NUMBEROFARTICLES}}]] [[Special:Allpages|articles]] about Unity and related subjects.&lt;br /&gt;
&lt;br /&gt;
Please see the [[:Talk:Main Page|discussion page]] of the main page for current goals and status.  '''Please read these [[:Help:Contents|general guidelines]] before you begin editing.'''&lt;br /&gt;
&lt;br /&gt;
To create a new page, add a link to an existing page, then follow the link and edit the new page. It's a good idea to copy the layout from an existing page initially, to ensure that your contribution matches the conventions used in our existing articles.  If you just want to experiment, you can do so in the [[:Unify Community Wiki:Sandbox|sandbox]].&lt;br /&gt;
&lt;br /&gt;
== News ==&lt;br /&gt;
&lt;br /&gt;
* Added cutting edge Captcha (now with angled lines!) to the Sign Up process. This should (hopefully) cut down on all those wonderful Wow Gold Mining opportunity posts we've been deleting.&lt;br /&gt;
&lt;br /&gt;
* The wiki has changed homes again. The new server should be faster, it is much larger, and UT is providing backup off the server, Thanks! But as always moves are not simple things. When you find broken things feel free to contact Jeff (guategeek) Neil (Ncarter) Jon (Aarku) or David Helgason so we can try get them fixed ASAP. Thanks again for all the great stuff you guys are posing here.&lt;br /&gt;
&lt;br /&gt;
* It is now possible to upload '''zip''' archives to the Unify wiki.  We encourage you to provide a zipped copy of your script or shader when adding a new article, as this will help to avoid the bug in Safari which inserts garbage characters into text which is copied and pasted from these pages.&lt;br /&gt;
&lt;br /&gt;
* The maximum file size for any uploaded file is now '''256KB''', and this includes images as well as zip files.  Unfortunately, '''unityPackage''' files are not directly supported at present, as we have been unable to make MediaWiki recognise the unusually long filename extension.  If you wish to add a unityPackage to the wiki, please zip it first.&lt;br /&gt;
&lt;br /&gt;
''Known problem: the page which appears when you upload a file is mangled, but the image upload will still work successfully.  We will try to fix this as soon as possible.''&lt;br /&gt;
&lt;br /&gt;
== Call for Article Requests ==&lt;br /&gt;
Please see the [[:Talk:Main Page|discussion page]] of the main page to add your requests for scripts, shaders, tips, or wizards.&lt;br /&gt;
&lt;br /&gt;
== Main Sections ==&lt;br /&gt;
&lt;br /&gt;
* [[Script Archive|Script Archive]] - Scripts for everything from general purpose effects to debugging.&lt;br /&gt;
&lt;br /&gt;
* [[Shader Archive|Shader Archive]] - Specialised shaders to make your materials more refined.&lt;br /&gt;
&lt;br /&gt;
* [[Tips|Tips and Tricks]] - Tips and tricks for Unity and related applications.&lt;br /&gt;
&lt;br /&gt;
* [[Wizard Archive|Wizard Archive]] - Wizard scripts to extend the Unity editor.&lt;br /&gt;
&lt;br /&gt;
* [[Tutorials|Tutorials Archive]] - Tutorials for all things Unity.  These are usually of larger scope than [[Tips|Tips and Tricks]].&lt;br /&gt;
&lt;br /&gt;
* [[Extensions|Extensions Archive]] - Extensions for extending the functionality of unity - allowing you to add special features to your projects with relatively little code. This archive includes both .NET plugins (for both indie and pro licensees and webplayer projects) and regular plugins (pro-only feature, not available for webplayer projects).&lt;br /&gt;
&lt;br /&gt;
* [[Unify Community Wiki:Community Portal|Community Portal]] - Your portal to the Unity community.&lt;br /&gt;
&lt;br /&gt;
* [[Unity Projects|Unity Projects]] - Community development efforts to extend Unity.&lt;br /&gt;
&lt;br /&gt;
* [[User Contests|User Contests]] - User contests for fun &amp;amp; fame!&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Please see [http://meta.wikipedia.org/wiki/MediaWiki_i18n documentation on customizing the interface]&lt;br /&gt;
and the [http://meta.wikipedia.org/wiki/MediaWiki_User%27s_Guide MediaWiki User's Guide] for usage and configuration help.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Plugins</id>
		<title>Plugins</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Plugins"/>
				<updated>2008-10-01T17:29:08Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This content is deprecated. Original content moved to [[Extensions]].&lt;br /&gt;
&lt;br /&gt;
Plugins require Unity Pro.&lt;br /&gt;
&lt;br /&gt;
== Cross-Platform Plugins ==&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie, including synchronized sound, for which you have a codec installed, back to a texture.&lt;br /&gt;
&lt;br /&gt;
== Mac OS X Only Plugins ==&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - This plugin lets you simply use AudioInput.Volume to provide micrphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - This plugin lets you display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
* [[UniWii]] - This plugin lets you use Wiimotes as input devices.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2008-10-01T17:28:15Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Extensions or Plugins allow you to extend the functionality of unity - adding special features to your unity projects without the hazzle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
== .NET plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins differ from regular plugins in that they're essentially just .NET assemblies in plugin form. They are, when your project is built, merged with the compiled .NET code from your project scripts. This means that you can use them on a unity indie license as well as pro and in webplayers.&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path.html Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave.html Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
No entries yet.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Plugins ==&lt;br /&gt;
&lt;br /&gt;
Regular plugins can be written in many languages - for instance C or C++. A unity pro license is required to use these plugins. Also they will not function in webplayers.&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie, including synchronized sound, for which you have a codec installed, back to a texture.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - This plugin lets you simply use AudioInput.Volume to provide micrphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - This plugin lets you display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
* [[UniWii]] - This plugin lets you use Wiimotes as input devices.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2008-10-01T17:27:34Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Extensions or Plugins allow you to extend the functionality of unity - adding special features to your unity projects without the hazzle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
== .NET plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins differ from regular plugins in that they're essentially just .NET assemblies in plugin form. They are, when your project is built, merged with the compiled .NET code from your project scripts. This means that you can use them on a unity indie license as well as pro and in webplayers.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path.html Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave.html Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Plugins ==&lt;br /&gt;
&lt;br /&gt;
Regular plugins can be written in many languages - for instance C or C++. A unity pro license is required to use these plugins. Also they will not function in webplayers.&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie, including synchronized sound, for which you have a codec installed, back to a texture.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - This plugin lets you simply use AudioInput.Volume to provide micrphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - This plugin lets you display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
* [[UniWii]] - This plugin lets you use Wiimotes as input devices.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2008-10-01T17:27:17Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Extensions or Plugins allow you to extend the functionality of unity - adding special features to your unity projects without the hazzle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
== .NET plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins differ from regular plugins in that they're essentially just .NET assemblies in plugin form. They are, when your project is built, merged with the compiled .NET code from your project scripts. This means that you can use them on a unity indie license as well as pro and in webplayers.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path.html Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave.html Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Plugins ==&lt;br /&gt;
&lt;br /&gt;
Regular plugins can be written in many languages - for instance C or C++. A unity pro license is required to use these plugins. Also they will not function in webplayers.&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie, including synchronized sound, for which you have a codec installed, back to a texture.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - This plugin lets you simply use AudioInput.Volume to provide micrphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - This plugin lets you display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
* [[UniWii]] - This plugin lets you use Wiimotes as input devices.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	<entry>
		<id>http://wiki.unity3d.com/index.php/Extensions</id>
		<title>Extensions</title>
		<link rel="alternate" type="text/html" href="http://wiki.unity3d.com/index.php/Extensions"/>
				<updated>2008-10-01T17:26:49Z</updated>
		
		<summary type="html">&lt;p&gt;AngryAnt: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Extensions or Plugins allow you to extend the functionality of unity - adding special features to your unity projects without the hazzle of writing them yourself from the ground up.&lt;br /&gt;
&lt;br /&gt;
== .NET plugins ==&lt;br /&gt;
&lt;br /&gt;
.NET plugins differ from regular plugins in that they're essentially just .NET assemblies in plugin form. They are, when your project is built, merged with the compiled .NET code from your project scripts. This means that you can use them on a unity indie license as well as pro and in webplayers.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/path.html Path] - Add pathfinding to your unity projects. Path implements the A* algorithm on NavMeshes, using multi-threading and several optimisation tricks to reduce calculation time.&lt;br /&gt;
&lt;br /&gt;
*[http://angryant.com/behave.html Behave] - Via an editor extension and a runtime library, this project implements behaviour trees in unity for AI decision making. It features an easy to use drag-drop design interface and compiles designed behaviour trees are compiled to .NET plugins with a simple, but versatile runtime interface.&lt;br /&gt;
&lt;br /&gt;
== Plugins ==&lt;br /&gt;
&lt;br /&gt;
Regular plugins can be written in many languages - for instance C or C++. A unity pro license is required to use these plugins. Also they will not function in webplayers.&lt;br /&gt;
&lt;br /&gt;
==== Cross-Platform Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[QTPlayback]] - Play any QuickTime movie, including synchronized sound, for which you have a codec installed, back to a texture.&lt;br /&gt;
&lt;br /&gt;
==== Mac OS X Only Plugins ====&lt;br /&gt;
&lt;br /&gt;
*[[AudioInput]] - This plugin lets you simply use AudioInput.Volume to provide micrphone or other audio input to your Unity projects.&lt;br /&gt;
&lt;br /&gt;
*[[HtmlTexturePlugin]] - This plugin lets you display an HTML page as a texture, for use on a mesh or in a GUI.&lt;br /&gt;
&lt;br /&gt;
* [[UniWii]] - This plugin lets you use Wiimotes as input devices.&lt;/div&gt;</summary>
		<author><name>AngryAnt</name></author>	</entry>

	</feed>