Scripts/General

From Unify Community Wiki
(Difference between revisions)
Jump to: navigation, search
(Really Simple Scripts)
(moved many links to development/utility page)
 
(61 intermediate revisions by 29 users not shown)
Line 1: Line 1:
{| style="width:100%; margin:auto; background:transparent;" cellspacing="0" cellpadding="0" valign="top" border="0" |
+
{{Scripts Navigation}}
| style="padding:0 .3em; background-color:#CEE0F2; font-size:90%; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{1|[[Scripts/General| General]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
  
| style="padding:0.3em; font-size:90%; background-color:#CEE0F2; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Editor| Editor]]}}}
+
== Input ==
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0.3em; font-size:90%; background-color:#CEE0F2; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Controllers| Controllers]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0 .3em; background-color:#CEE0F2; font-size:90%; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/GUI|GUI]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0.3em; font-size:90%; background-color:#CEE0F2; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Effects| Effects]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0.3em; font-size:90%; background-color:#CEE0F2; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Physics| Physics / Simulation]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0 .3em; background-color:#CEE0F2; font-size:90%; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Networking| Networking]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0.3em; font-size:90%; background-color:#CEE0F2; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Sound| Sound]]}}}
+
+
| style="border-bottom:2px solid #A3B1BF" width="1%" |  
+
+
| style="padding:0 .3em; background-color:#CEE0F2; font-size:90%; border:solid 2px #A3B1BF; text-align:center" width="8%" | {{{2|[[Scripts/Development| Development]]}}}
+
|-
+
{|cellspacing="10px" valign="top" style="background:white; border-left:2px solid #A3B1BF; border-right:2px solid #A3B1BF"
+
|-
+
| valign="top"|
+
  
{| align="right"
+
*[[KeyboardEventManager]] - An event-based keyboard input manager.
  | __TOC__
+
*[[IPhoneToMouse]] - Replaces iPhoneInput commands with Input so you can use it in PC/Mac Version too.
  |}
+
*[[FingerManager]] - Easily manage multi-touch phases for iPhone.
  
== General Concepts ==
+
== Data Structures ==
  
*[[AManagerClass]] - How to add easy access to a singleton class in a scene.
+
*[[ArrayTools]] - Functions to use built-in arrays like an ArrayList.
*[[AStarHelper]] - Textbook implementation of the A* pathing routine.
+
*[[DeepCopy]] - Creates a deep copy of an array or hashtable.
*[[BasicDataStructures]] - Discussion of the use of the data-structures available in Unity.
+
*[[MultiKeyDictionary]] - Like a Dictionary, but you can have two keys for each elements.
*[[CoroutineScheduler]] - A coroutine scheduler implementation. Gain a better understanding of coroutines.
+
*[[ObjectCopier]] - An alternative to IClonable.
*[[CoUpdate]] - An alternative to Update which support yield instructions. Benefit from cleaner code.
+
*[[ParallelKeyDictionary]] - Like a Dictionary, but you can have identical keys.
*[[EnumeratedDelegate]] - A method to setup a quick and dirty Finite State Machine of sorts by means of generics, delegates and an enum.
+
*[[ReflectedObject]] - Reflects a target object, providing quick access by name to reading/writing its fields/properties, and calling its methods.  
*[[Executors_Framework|Executors Framework]] - A framework for multi-threading without getting a headache. (Warning: The Unity API is not thread-safe)
+
*[[Set]] - A set data structure.
*[[FakeGizmoDemo]] - simple example of creating a fake Gizmo - a three-arrow axis, mouse-moveable, that can be applied to an object at Runtime, not just during editing. Also contains an example of Procedural Mesh Creation - using only code to create an in-game mesh object from vertices and triangles.
+
*[[FindingClosestObject]] - How to find the closest object to the player, defined by layer. Using Physics.OverlapSphere, an IComparer and InvokeRepeating. Script in JS.
+
 
*[[JavascriptMultiDimArrays]] - Declare multi-dimensional arrays like int[,] or int[][] in JS (mostly obsolete in Unity 3.2, though still useful for jagged arrays)
 
*[[JavascriptMultiDimArrays]] - Declare multi-dimensional arrays like int[,] or int[][] in JS (mostly obsolete in Unity 3.2, though still useful for jagged arrays)
*[[Lipis Runtime Gizmo]] - Update on Lipis Runtime Gizmo (works with Translation, Rotation, and Scale).  Included C# code and corrected javascript code removing unity 3D reserved words in code.
 
*[[SimpleRegex]] - How one might use regular expressions in Unity.
 
 
*[[SQLite]] - How to integrate SQLite into your project.
 
*[[SQLite]] - How to integrate SQLite into your project.
*[[ToggleGravity]] - How to toggle a property, in this case the global gravity setting, by the left mouse button.
 
  
== Messaging Systems ==
+
== Strings ==
*[[Advanced CSharp Messenger]] - Simple and efficient C# messaging system implemented with delegates and generics. Allows for logging of messages, has extended error detection, and adds extra protection from unexpected exceptions.
+
*[[BooMessenger]] - An efficient and simple to use messaging platform. Allows hierarchial grouping of message types.
+
*[[CSharpEventManager]] - C# implementation of a messaging/notification system. Allows subscription to events without referencing their definitions.
+
*[[CSharpMessenger]] - Another C# messaging/notification system implemented using delegates and generics.
+
*[[CSharpMessenger Extended]] - C# messaging system using delegates and generics. Based on [[CSharpMessenger]] but has more error detection.
+
*[[DelayedDelegates]] - An easy, central way to call function with a delay
+
*[[MessageRouter]] - subscription based messaging with delayed notification, delivery stages, message filtering, tagging, and receiver assertions
+
*[[NotificationCenter]] - Register scripts to receive and post notifications.  Handles messaging across scripts without references to each other. (See also [http://www.unifycommunity.com/wiki/index.php?title=NotificationCenterGenerics NotificationCenterGenerics] for a version that has stricter typing.)
+
*[[CSharpNotificationCenter]] - C# implementation of the "NotificationCenter" script. Register scripts to receive and post notifications.  Handles messaging across scripts without references to each other.
+
  
== Utility Scripts ==
+
*[[SimpleRegex]] - How one might use regular expressions in Unity.
 +
*[[LanguageFilter]] - Removes badwords from strings using regular expressions.
 +
*[[MD5]] - Generate an MD5 hash for a string.
 +
*[[ExpressionParser]] - A simple extensible expression parser that can evaluate mathematical string-expressions.
 +
*[[Scripts/StringFilter|StringFilter]] - A class to allow string filtering based on a list of exclude words / char.
 +
*[[StringToValue]] - Functions for finding data within a string.
 +
*[[StringUtil]] - Word wrap and line count functions.
 +
*[[IPhoneDeviceModel]] - Plugin that return the iPhone Device Model as a string.
 +
*[[TextScanner]] - A utility class for parsing strings using std C sscanf format strings.
 +
*[[SecondsToText]] - Convert seconds to a text time string using the highest set available.
 +
*[[TextManager]] - Uses [http://en.wikipedia.org/wiki/Gettext gettext] and PO Editor for translating text.
 +
 
 +
== Texture/Color ==
  
*[[AddChild]] - Adds an empty GameObject as a child of each selected object.
 
*[[Angle]] - Helper class to work with angles.
 
*[[ArrayPrefs]] - Functions for saving and loading arrays of ints, floats, and strings using PlayerPrefs. (Made obsolete by [[ArrayPrefs2]].)
 
*[[ArrayPrefs2]] - Faster and better than ArrayPrefs. Save/load Vector2, Vector3, Quaternion, Color as well as a bunch of different array types.
 
*[[ArrayTools]] - Functions to use built-in arrays like an ArrayList.
 
*[[Autorun]] - Execute some code exactly once, whenever the project is opened, recompiled, or run.
 
*[[AutoSave]] - This script creates a new window in the editor with a autosave function. It is saving your current scene with an interval from 1 minute to 10 minutes.
 
*[[BoneDebug]] - Draws debug bones in a character.
 
*[[BoolPrefs]] - Adds GetBool and SetBool, which are missing from PlayerPrefs.
 
*[[Bresenham3D]] - An enumerator that allows you to loop through all integer Vector3's along a line.
 
*[[ComponentInstantiationUtility]] - Static C# class that allows you to instantiate pre-parented components as game objects with one easy line of code.
 
*[[CustomRandom]] - C# Random number generator, when you must have a random number generator that works the same way on all platforms!
 
*[[DeepCopy]] - Creates a deep copy of an array or hashtable.
 
*[[deepSearch]] - Searches recursively from the parent down.
 
*[[ExpandoObject]] - Create ECMAScript-style expando objects in Unity Javascript.
 
*[[ExtRandom]] - An extension to the Unity class Random
 
*[[FingerManager]] - Easily manage multi-touch phases for iPhone.
 
*[[GeneralTimer]] - A simple timer component that includes a few extra methods for ease of use.
 
*[[Google Analytics]] - A script component that allows for event logging to Google Analytics.
 
*[[HexConverter]] - Functions for converting decimal colors to hexadecimal... and back.
 
 
*[[HSBColor]] - This utility script provides a HSB color model in addition to Unity's built in RGB Color class.
 
*[[HSBColor]] - This utility script provides a HSB color model in addition to Unity's built in RGB Color class.
*[[Interpolate]] - Interpolation utility functions for easing, Bezier splines, and Catmull-Rom splines.
 
*[[IsVisibleFrom]] - An extension method for checking if an Renderer is rendered by a specific Camera.
 
*[[IPhoneToMouse]] - Replaces iPhoneInput commands with Input so you can use it in PC/Mac Version too.
 
*[[IPhone Build Utility Script]] - This script copies the icon and splash screen every time the project is built.
 
*[[KeyboardEventManager]] - An event-based keyboard input manager.
 
 
*[[LABColor]] - This utility script provides an LAB color model. Lab color is designed to approximate human vision and so it aspires to perceptual uniformity.
 
*[[LABColor]] - This utility script provides an LAB color model. Lab color is designed to approximate human vision and so it aspires to perceptual uniformity.
*[[LanguageFilter]] - Removes badwords from strings using regular expressions.
 
*[[LayerMaskExtensions]] - Extension class to add usability and easier debugging to LayerMasks.
 
*[[Layers]] - A utility script for holding easily-accessible layers and easily creating masks.
 
*[[Mathfx]] - This script contains a growing number of small and useful math functions (short for Mathf eXtended).
 
*[[Matrix]] - A class for doing 3D matrix math against Vector3 objects.
 
 
*[[MaxRectsBinPack]] - A port of Jukka Jylänki's Max Rect algorithm, useful for generating sprite atlases
 
*[[MaxRectsBinPack]] - A port of Jukka Jylänki's Max Rect algorithm, useful for generating sprite atlases
*[[MazeGenerator]] - Randomly generates a maze.
+
*[[MiniEXR]] - A class that allows writing 16-bit EXR files directly from Unity.
*[[MD5]] - Generate an MD5 hash for a string.
+
*[[TextureDrawCircle]] - A function that draws circles inside a texture.
 +
*[[TextureDrawLine]] - A function that draws lines inside a texture.
 +
*[[TextureFloodFill]] - A floodfill extension for Texture2D.
 +
*[[TextureScale]] - Resize textures, while scaling the contents using either bilinear or point filtering.
 +
*[[TextureUtils]] - Functions for colorizing, masking, and merging textures at runtime.
 +
*[[UnityPaint]] - A script to draw anti-aliased lines, brush strokes and vector lines on a texture.
 +
*[[XKCDColors]] - A collection of 948 color constants, from the xkcd color survey (C#).
 +
*[[XKCDColorsByIndex]] - A modified version of [[XKCDColors]], accessible by index rather than name.
 +
 
 +
== Meshes ==
 +
 
 +
*[[FastObjImporter]] - Fast importer for Blender .obj files at runtime.
 
*[[MeshCreationGrid]] - Shows how to procedurally generate a mesh with proper vertices and uvs to work as a tile-grid
 
*[[MeshCreationGrid]] - Shows how to procedurally generate a mesh with proper vertices and uvs to work as a tile-grid
 
*[[MeshCreationHelper]] - Helper to create a new mesh from some mesh's submesh.
 
*[[MeshCreationHelper]] - Helper to create a new mesh from some mesh's submesh.
Line 113: Line 57:
 
*[[MeshSmoother]] - Deformation of a mesh by applying Laplacian/HC-Algorithm Smoother, also script for finding adjacent vertices in a mesh.
 
*[[MeshSmoother]] - Deformation of a mesh by applying Laplacian/HC-Algorithm Smoother, also script for finding adjacent vertices in a mesh.
 
*[[MeshSubdivision]] - Center and edge subdivision.
 
*[[MeshSubdivision]] - Center and edge subdivision.
*[[MetadataSystem]] - Mechanism for ciphered, compressed preferences and declarative metadata system with runtime overrides.
 
 
*[[MetaMorph]] - MetaMorph is a Unity3d and Blender3d toolkit that allows mesh animation in Unity games using Blender shapekeys.
 
*[[MetaMorph]] - MetaMorph is a Unity3d and Blender3d toolkit that allows mesh animation in Unity games using Blender shapekeys.
*[[MixupGO]] - Flatten GameObjects and all attached components into a single object using duck typing  in Unity Javascript.
 
*[[MultiKeyDictionary]] - Like a Dictionary, but you can have two keys for each elements.
 
*[[ObjectCopier]] - An alternative to IClonable.
 
 
*[[ObjExporter]] - A simple utility class for exporting a mesh to an obj file.
 
*[[ObjExporter]] - A simple utility class for exporting a mesh to an obj file.
 
*[[ObjExporterColorUvs]] - Enhanced version of [[ObjExporter]] that also exports vertex color and multiple uvsets to an obj file.
 
*[[ObjExporterColorUvs]] - Enhanced version of [[ObjExporter]] that also exports vertex color and multiple uvsets to an obj file.
 
*[[ObjImporter]] - Import .obj files at runtime.
 
*[[ObjImporter]] - Import .obj files at runtime.
*[[ParallelKeyDictionary]] - Like a Dictionary, but you can have identical keys.
 
*[[PlayerSave]] - Script with the functionality of PlayerPrefs, but lets you specify the save location for each platform.
 
*[[PlaySoundAtInterval]] - Plays a sound file at the specified intervals of time.
 
*[[PolyContainsPoint]] - Like Rect.Contains, except instead of a rect, you can define any arbitrary polygon.
 
 
*[[PolyOrderFixupOnImport]] - Replaces original polygon ordering in a mesh after possible unwanted optimizations by Unity.
 
*[[PolyOrderFixupOnImport]] - Replaces original polygon ordering in a mesh after possible unwanted optimizations by Unity.
 
*[[PrintPolyCount]] - Prints total vertex and triangle count in the object hierarchy.
 
*[[PrintPolyCount]] - Prints total vertex and triangle count in the object hierarchy.
*[[PropertyListSerializer]] - Loads and saves a .plist XML file to and from a hierarchical hashtable.
+
*[[ProceduralPrimitives]] - Codes to procedurally create custom primitive meshes.
*[[QuaternionExtensions]] - A set of useful extension methods to the inbuilt Quaternion struct.
+
*[[QuickTimer]] - A poll based timer useful in "called on each frame" methods.
+
*[[ReflectedObject]] - Reflects a target object, providing quick access by name to reading/writing its fields/properties, and calling its methods.
+
*[[Set]] - A set data structure.
+
*[[Shell]] - A replacement for the built-in shell function removed from Unity 1.6.1.
+
*[[SimpleDictionary]] - Implements a simple dictionary-like object AND lets you save/load the dictionaries to text files.
+
*[[Simple LOD Manager]] - Script to handle arbitrary number and distances for Level-Of-Detail in models
+
 
*[[SkinnedMeshTools]] - Copy one skinnedmesh renderer onto another with same bones. Think swappable equipment pieces.
 
*[[SkinnedMeshTools]] - Copy one skinnedmesh renderer onto another with same bones. Think swappable equipment pieces.
*[[SpeedLerp]] - Replacements for Mathf.Lerp, InverseLerp, SmoothStep, etc. that are typically 1.5X faster or more. Also adds Vector2Lerp and SuperLerp.
 
*[[SphericalCoordinates]] - A class to manipulate an object's position with spherical coordinates instead of cartesian.
 
*[[Startup Manager]] - A singleton class that handles starting up scripts in a sorted order based on a priority variable
 
*[[StringToValue]] - Functions for finding data within a string.
 
*[[StringUtil]] - Word wrap and line count functions.
 
*[[TextManager]] - Uses [http://en.wikipedia.org/wiki/Gettext gettext] and PO Editor for translating text.
 
*[[TextScanner]] - A utility class for parsing strings using std C sscanf format strings.
 
*[[TextureDrawCircle]] - A function that draws circles inside a texture.
 
*[[TextureDrawLine]] - A function that draws lines inside a texture.
 
*[[TextureFloodFill]] - A floodfill extension for Texture2D.
 
*[[TextureScale]] - Resize textures, while scaling the contents using either bilinear or point filtering.
 
*[[TextureUtils]] - Functions for colorizing, masking, and merging textures at runtime.
 
*[[TileSelector]] - An Inspector extension that creates a pop-up window to select a tile or a NxM group of tiles from a main tileset, for use in a sprite object.
 
*[[TinyXmlReader]] - A class that reads XML text and parses it for use.
 
*[[TinyXmlReaderWeb]] - TinyXmlReader to use with the web player.
 
 
*[[Triangulator]] - A utility class for splitting a 2D polygon into triangles.
 
*[[Triangulator]] - A utility class for splitting a 2D polygon into triangles.
*[[UnitSphere]] - A collection of random unit vector generating functions. (C#)
 
*[[Unity_Custom_Input_Manager]] - Allows you to change input configuration on the fly. Default inputmanager only allows you to change on start.
 
*[[UnityPaint]] - A script to draw anti-aliased lines, brush strokes and vector lines on a texture.
 
 
*[[UVTransfer]] - Editor script to transfer UVs between two models.
 
*[[UVTransfer]] - Editor script to transfer UVs between two models.
 
*[[VertexInfo]] - Displays the vertex numbers of a mesh at the runtime.
 
*[[VertexInfo]] - Displays the vertex numbers of a mesh at the runtime.
*[[XKCDColors]] - A collection of 948 color constants, from the xkcd color survey (C#).
 
  
== Really Simple Scripts ==
+
== Other ==
  
 +
*[[Accessing number of drawcalls from script]] - Retrieve the number of drawcalls for statistical purposes
 +
*[[Calculating Lead For Projectiles]] - These script fragments allow you to add some lead ahead of the target allowing
 +
*[[Low Pass Filter]] - These functions apply a low pass filter to a Vector3 and a Quaternion value. Useful to get rid of jitter.
 +
*[[Averaging Quaternions and Vectors]] - Simple method of averaging rotational values (quaternion) and positions (vector).
 +
*[[3d Math functions]] - This is a collection of generic 3d math functions such as line - plane intersection, closest points on two lines, etc.
 +
*[[ScaleTransform]] - A method allows you to scale a GameObject transform to a specific size along the x & z axis by taking into account the GameObjects renderer bounds if a renderer component is attached. Also takes into account any children of the transform.
 +
*[[Windows Saved Game Directory]] - Query the path of the <tt>Saved Games</tt> directory (Vista and up) with fallback to <tt>My Documents\My Games</tt> on Windows systems.
 +
*[[Bresenham3D]] - An enumerator that allows you to loop through all integer Vector3's along a line.
 +
*[[ComponentInstantiationUtility]] - Static C# class that allows you to instantiate pre-parented components as game objects with one easy line of code.
 +
*[[deepSearch]] - Searches recursively from the parent down.
 +
*[[DrawGizmoGrid]] - Draws a grid centered on your gameobject using the Gizmos api.
 +
*[[ExpandoObject]] - Create ECMAScript-style expando objects in Unity Javascript.
 +
*[[Google Analytics]] - A script component that allows for event logging to Google Analytics.
 +
*[[Interface Finder]] - A script that will allow you to find classes that implement a certain interface in a scene.
 +
*[[IsVisibleFrom]] - An extension method for checking if an Renderer is rendered by a specific Camera.
 +
*[[IPhone Build Utility Script]] - This script copies the icon and splash screen every time the project is built.
 +
*[[JobQueue]] - A threaded job queue with an internal thread pool.
 +
*[[LayerMaskExtensions]] - Extension class to add usability and easier debugging to LayerMasks.
 +
*[[Layers]] - A utility script for holding easily-accessible layers and easily creating masks.
 +
*[[MixupGO]] - Flatten GameObjects and all attached components into a single object using duck typing  in Unity Javascript.
 +
*[[PrintExtended]] - Additional print methods.
 +
*[[RayCastWithoutPhysics]] - Raycast without pixel color, takes 1/4 of a second to Raycast using Zbuffer.
 +
*[[ScrollingBG]] - A simple scrolling class useful for easy 2d paralaxed backgrounds.
 +
*[[Shell]] - A replacement for the built-in shell function removed from Unity 1.6.1.
 +
*[[Simple LOD Manager]] - Script to handle arbitrary number and distances for Level-Of-Detail in models
 +
*[[TileSelector]] - An Inspector extension that creates a pop-up window to select a tile or a NxM group of tiles from a main tileset, for use in a sprite object.
 +
*[[TitleSafeAreaDisplay]] - Helper that renders guides for visualizing title safe area.
 +
*[[WeightedRandomizer]] - Selects a random element from a collection where each item has a different weight (% chance of being selected). (C#)
 +
*[[ToggleCapsLock]] - Checks and sets the state of the caps lock key's toggle.
 +
*[[MazeGenerator]] - Randomly generates a maze.
 
*[[3DMenu]] - A simple main menu for 3d text in your scene
 
*[[3DMenu]] - A simple main menu for 3d text in your scene
 +
*[[CameraFog]] - Modifies a camera to allows you to control the fog settings for that camera separately from the global scene fog or other cameras.
 
*[[ConstantVelocity]] - Set a local velocity to an object (useful for missiles perhaps?)
 
*[[ConstantVelocity]] - Set a local velocity to an object (useful for missiles perhaps?)
 +
*[[Cubescape]] - Simple perlin cube landscape, can be made voxel.
 
*[[Flag]] - Simple bitwise logical operations.
 
*[[Flag]] - Simple bitwise logical operations.
 
*[[Flashlight]] - Allows the switching on and off of a light in script.
 
*[[Flashlight]] - Allows the switching on and off of a light in script.
*[[UpdatePump]] - Register any method in any object to be called in one of Unity's update loops.
+
*[[GameObjectLock]] - A simple script written in C# that can lock a game objects position, rotation or scale independently or set a global lock to prevent those values from changing.
 +
*[[LevelUp]] - Provides the basic formula for leveling up characters based on experience points.
 +
*[[ModularConstruction]] - Basic general purpose modular building system for Rust-like buildings, or anything else made from modules.
 
*[[OldSchoolSteering]] - Rotate a transform towards 8 axes by assigning a new forward-direction from the horizontal and vertical inputs.
 
*[[OldSchoolSteering]] - Rotate a transform towards 8 axes by assigning a new forward-direction from the horizontal and vertical inputs.
 
*[[OnCollideExplode]] - Spawn a prefab (explosion) on collision, and remove the GameObject from the game.
 
*[[OnCollideExplode]] - Spawn a prefab (explosion) on collision, and remove the GameObject from the game.
*[[OnCollideSound]] - Spawn a prefab (preferably a sound) if a collision is over a certain magnitude.
 
 
*[[OnExplosionEffect]] - Give an explosive effect over an area.
 
*[[OnExplosionEffect]] - Give an explosive effect over an area.
 
*[[OnMouseDown]] - Sends OnMouseDown messages on an iPhone.
 
*[[OnMouseDown]] - Sends OnMouseDown messages on an iPhone.
 
*[[PointerManager]] - Hides the mouse pointer when it is not in use.
 
*[[PointerManager]] - Hides the mouse pointer when it is not in use.
*[[SecondsToText]] - Convert seconds to a text time string using the highest set available.
 
 
*[[SwitchCamera]] - Switches between cameras in your scene.
 
*[[SwitchCamera]] - Switches between cameras in your scene.
 
*[[Teleporter]] - Teleport all objects from one place to another.
 
*[[Teleporter]] - Teleport all objects from one place to another.
*[[TimeOfDay]] - Compute the game time into hours, minutes and secondes depending on the duration of a day.
+
*[[TransformRotation2D]] - Represent Transform rotations with just a float (useful for 2D games).
*[[GameObjectLock]] - A simple script written in C# that can lock a game objects position, rotation or scale independently or set a global lock to prevent those values from changing.
+
*[[AStarHelper]] - Textbook implementation of the A* pathing routine.
 
+
*[[ClassTypeReference]] - Serializable reference to <code>System.Type</code> for class types with custom property drawer and attributes to filter selection for editor interfaces.
== Code Snippets ==
+
*[[EnumeratedDelegate]] - A method to setup a quick and dirty Finite State Machine of sorts by means of generics, delegates and an enum.
 
+
*[[Executors_Framework|Executors Framework]] - A framework for multi-threading without getting a headache. (Warning: The Unity API is not thread-safe)
*[[Accessing number of drawcalls from script]] - Retrieve the number of drawcalls for statistical purposes
+
*[[FakeGizmoDemo]] - Simple example of creating a fake Gizmo that can be applied to an object at runtime, not just in the editor.
*[[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.
+
*[[FindingClosestObject]] - How to find the closest object to the player, defined by layer. Using Physics.OverlapSphere, an IComparer and InvokeRepeating. Script in JS.
*[[Load Data from Excel 2003]] - This script allows you to load information from excel spreadsheets into Unity, written in C#.
+
*[[Lipis Runtime Gizmo]] - Update on Lipis Runtime Gizmo (works with Translation, Rotation, and Scale). Included C# code and corrected javascript code removing unity 3D reserved words in code.
*[[Save and Load from XML]] - This script allows you to save and load data from an XML file, written in C# (JS version included).
+
*[[Lock Free Queue]] - Queue that can be simultaneously enqueued to and dequeued from, even from multiple threads.
*[[Save and Load from XML U3 Collections]] - Save and load all game objects in a scene, modify the code to add in what you want saved about the game object, written in C#.
+
*[[ToggleGravity]] - How to toggle a property, in this case the global gravity setting, by the left mouse button.
*[[LookRotation alternative]] - This function enables you to use a custom forward and up vector instead of the default fixed forward and up vector.
+
*[[Low Pass Filter]] - These functions apply a low pass filter to a Vector3 and a Quaternion value. Useful to get rid of jitter.
+
*[[Averaging Quaternions and Vectors]] - Simple method of averaging rotational values (quaternion) and positions (vector).
+
*[[3d Math functions]] - This is a collection of generic 3d math functions such as line - plane intersection, closest points on two lines, etc.
+
 
+
|}
+
<div style="border:2px solid #A3B1BF;padding:.5em 1em 1em 1em; border-top:none; border-bottom:2px solid #A3B1BF;  border-right:2px solid #A3B1BF; background-color:#ffffff; color:#000;">
+
 
+
</div>
+

Latest revision as of 23:45, 14 November 2018

Scripts   General   Editor   Controllers   UI   Effects   Physics/Simulation   Networking   Audio   Utility

Contents

[edit] Input

[edit] Data Structures

  • ArrayTools - Functions to use built-in arrays like an ArrayList.
  • DeepCopy - Creates a deep copy of an array or hashtable.
  • MultiKeyDictionary - Like a Dictionary, but you can have two keys for each elements.
  • ObjectCopier - An alternative to IClonable.
  • ParallelKeyDictionary - Like a Dictionary, but you can have identical keys.
  • ReflectedObject - Reflects a target object, providing quick access by name to reading/writing its fields/properties, and calling its methods.
  • Set - A set data structure.
  • JavascriptMultiDimArrays - Declare multi-dimensional arrays like int[,] or int[][] in JS (mostly obsolete in Unity 3.2, though still useful for jagged arrays)
  • SQLite - How to integrate SQLite into your project.

[edit] Strings

  • SimpleRegex - How one might use regular expressions in Unity.
  • LanguageFilter - Removes badwords from strings using regular expressions.
  • MD5 - Generate an MD5 hash for a string.
  • ExpressionParser - A simple extensible expression parser that can evaluate mathematical string-expressions.
  • StringFilter - A class to allow string filtering based on a list of exclude words / char.
  • StringToValue - Functions for finding data within a string.
  • StringUtil - Word wrap and line count functions.
  • IPhoneDeviceModel - Plugin that return the iPhone Device Model as a string.
  • TextScanner - A utility class for parsing strings using std C sscanf format strings.
  • SecondsToText - Convert seconds to a text time string using the highest set available.
  • TextManager - Uses gettext and PO Editor for translating text.

[edit] Texture/Color

  • HSBColor - This utility script provides a HSB color model in addition to Unity's built in RGB Color class.
  • LABColor - This utility script provides an LAB color model. Lab color is designed to approximate human vision and so it aspires to perceptual uniformity.
  • MaxRectsBinPack - A port of Jukka Jylänki's Max Rect algorithm, useful for generating sprite atlases
  • MiniEXR - A class that allows writing 16-bit EXR files directly from Unity.
  • TextureDrawCircle - A function that draws circles inside a texture.
  • TextureDrawLine - A function that draws lines inside a texture.
  • TextureFloodFill - A floodfill extension for Texture2D.
  • TextureScale - Resize textures, while scaling the contents using either bilinear or point filtering.
  • TextureUtils - Functions for colorizing, masking, and merging textures at runtime.
  • UnityPaint - A script to draw anti-aliased lines, brush strokes and vector lines on a texture.
  • XKCDColors - A collection of 948 color constants, from the xkcd color survey (C#).
  • XKCDColorsByIndex - A modified version of XKCDColors, accessible by index rather than name.

[edit] Meshes

  • FastObjImporter - Fast importer for Blender .obj files at runtime.
  • MeshCreationGrid - Shows how to procedurally generate a mesh with proper vertices and uvs to work as a tile-grid
  • MeshCreationHelper - Helper to create a new mesh from some mesh's submesh.
  • MeshHelper - Helper to subdivide into 2x2 or 3x3 and keep shared vertices / edges.
  • MeshMerger - Draw a large number of meshes with a single draw call.
  • MeshSmoother - Deformation of a mesh by applying Laplacian/HC-Algorithm Smoother, also script for finding adjacent vertices in a mesh.
  • MeshSubdivision - Center and edge subdivision.
  • MetaMorph - MetaMorph is a Unity3d and Blender3d toolkit that allows mesh animation in Unity games using Blender shapekeys.
  • ObjExporter - A simple utility class for exporting a mesh to an obj file.
  • ObjExporterColorUvs - Enhanced version of ObjExporter that also exports vertex color and multiple uvsets to an obj file.
  • ObjImporter - Import .obj files at runtime.
  • PolyOrderFixupOnImport - Replaces original polygon ordering in a mesh after possible unwanted optimizations by Unity.
  • PrintPolyCount - Prints total vertex and triangle count in the object hierarchy.
  • ProceduralPrimitives - Codes to procedurally create custom primitive meshes.
  • SkinnedMeshTools - Copy one skinnedmesh renderer onto another with same bones. Think swappable equipment pieces.
  • Triangulator - A utility class for splitting a 2D polygon into triangles.
  • UVTransfer - Editor script to transfer UVs between two models.
  • VertexInfo - Displays the vertex numbers of a mesh at the runtime.

[edit] Other

  • Accessing number of drawcalls from script - Retrieve the number of drawcalls for statistical purposes
  • Calculating Lead For Projectiles - These script fragments allow you to add some lead ahead of the target allowing
  • Low Pass Filter - These functions apply a low pass filter to a Vector3 and a Quaternion value. Useful to get rid of jitter.
  • Averaging Quaternions and Vectors - Simple method of averaging rotational values (quaternion) and positions (vector).
  • 3d Math functions - This is a collection of generic 3d math functions such as line - plane intersection, closest points on two lines, etc.
  • ScaleTransform - A method allows you to scale a GameObject transform to a specific size along the x & z axis by taking into account the GameObjects renderer bounds if a renderer component is attached. Also takes into account any children of the transform.
  • Windows Saved Game Directory - Query the path of the Saved Games directory (Vista and up) with fallback to My Documents\My Games on Windows systems.
  • Bresenham3D - An enumerator that allows you to loop through all integer Vector3's along a line.
  • ComponentInstantiationUtility - Static C# class that allows you to instantiate pre-parented components as game objects with one easy line of code.
  • deepSearch - Searches recursively from the parent down.
  • DrawGizmoGrid - Draws a grid centered on your gameobject using the Gizmos api.
  • ExpandoObject - Create ECMAScript-style expando objects in Unity Javascript.
  • Google Analytics - A script component that allows for event logging to Google Analytics.
  • Interface Finder - A script that will allow you to find classes that implement a certain interface in a scene.
  • IsVisibleFrom - An extension method for checking if an Renderer is rendered by a specific Camera.
  • IPhone Build Utility Script - This script copies the icon and splash screen every time the project is built.
  • JobQueue - A threaded job queue with an internal thread pool.
  • LayerMaskExtensions - Extension class to add usability and easier debugging to LayerMasks.
  • Layers - A utility script for holding easily-accessible layers and easily creating masks.
  • MixupGO - Flatten GameObjects and all attached components into a single object using duck typing in Unity Javascript.
  • PrintExtended - Additional print methods.
  • RayCastWithoutPhysics - Raycast without pixel color, takes 1/4 of a second to Raycast using Zbuffer.
  • ScrollingBG - A simple scrolling class useful for easy 2d paralaxed backgrounds.
  • Shell - A replacement for the built-in shell function removed from Unity 1.6.1.
  • Simple LOD Manager - Script to handle arbitrary number and distances for Level-Of-Detail in models
  • TileSelector - An Inspector extension that creates a pop-up window to select a tile or a NxM group of tiles from a main tileset, for use in a sprite object.
  • TitleSafeAreaDisplay - Helper that renders guides for visualizing title safe area.
  • WeightedRandomizer - Selects a random element from a collection where each item has a different weight (% chance of being selected). (C#)
  • ToggleCapsLock - Checks and sets the state of the caps lock key's toggle.
  • MazeGenerator - Randomly generates a maze.
  • 3DMenu - A simple main menu for 3d text in your scene
  • CameraFog - Modifies a camera to allows you to control the fog settings for that camera separately from the global scene fog or other cameras.
  • ConstantVelocity - Set a local velocity to an object (useful for missiles perhaps?)
  • Cubescape - Simple perlin cube landscape, can be made voxel.
  • Flag - Simple bitwise logical operations.
  • Flashlight - Allows the switching on and off of a light in script.
  • GameObjectLock - A simple script written in C# that can lock a game objects position, rotation or scale independently or set a global lock to prevent those values from changing.
  • LevelUp - Provides the basic formula for leveling up characters based on experience points.
  • ModularConstruction - Basic general purpose modular building system for Rust-like buildings, or anything else made from modules.
  • OldSchoolSteering - Rotate a transform towards 8 axes by assigning a new forward-direction from the horizontal and vertical inputs.
  • OnCollideExplode - Spawn a prefab (explosion) on collision, and remove the GameObject from the game.
  • OnExplosionEffect - Give an explosive effect over an area.
  • OnMouseDown - Sends OnMouseDown messages on an iPhone.
  • PointerManager - Hides the mouse pointer when it is not in use.
  • SwitchCamera - Switches between cameras in your scene.
  • Teleporter - Teleport all objects from one place to another.
  • TransformRotation2D - Represent Transform rotations with just a float (useful for 2D games).
  • AStarHelper - Textbook implementation of the A* pathing routine.
  • ClassTypeReference - Serializable reference to System.Type for class types with custom property drawer and attributes to filter selection for editor interfaces.
  • EnumeratedDelegate - A method to setup a quick and dirty Finite State Machine of sorts by means of generics, delegates and an enum.
  • Executors Framework - A framework for multi-threading without getting a headache. (Warning: The Unity API is not thread-safe)
  • FakeGizmoDemo - Simple example of creating a fake Gizmo that can be applied to an object at runtime, not just in the editor.
  • FindingClosestObject - How to find the closest object to the player, defined by layer. Using Physics.OverlapSphere, an IComparer and InvokeRepeating. Script in JS.
  • Lipis Runtime Gizmo - Update on Lipis Runtime Gizmo (works with Translation, Rotation, and Scale). Included C# code and corrected javascript code removing unity 3D reserved words in code.
  • Lock Free Queue - Queue that can be simultaneously enqueued to and dequeued from, even from multiple threads.
  • ToggleGravity - How to toggle a property, in this case the global gravity setting, by the left mouse button.
Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox