Scripts

From Unify Community Wiki
Revision as of 02:51, 16 February 2010 by Tortoise (Talk | contribs)

Jump to: navigation, search

Contents

General

General Concepts

  • AManagerClass - How to add easy access to a singleton class in a scene.
  • BasicDataStructures - Discussion of the use of the data-structures available in Unity.
  • 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.
  • JavascriptMultiDimArrays - Declare multi-dimensional (rectangular) arrays like int[,], as well as jagged arrays like int[][], which is not normally possible in Javascript
  • 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.
  • SimpleRegex - How one might use regular expressions in Unity.
  • ToggleGravity - How to toggle a property, in this case the global gravity setting, by the left mouse button.
  • BooMessenger - An efficient and simple to use messaging platform.

Utility Scripts

  • Angle - Helper class to work with angles.
  • ArrayPrefs - Functions for saving and loading arrays of ints, floats, and strings using PlayerPrefs.
  • BoolPrefs - Adds GetBool and SetBool, which are missing from PlayerPrefs.
  • CustomRandom - C# Random number generator, when you must have a random number generator that works the same way on all platforms!
  • deepSearch - Searches recursively from the parent down.
  • Dictionary SimpleDictionary -- implements a simple dictionary-like object AND lets you save/load the dictionaries to text files.
  • ExpandoObject - Create ECMAScript-style expando objects in Unity Javascript.
  • FingerManager - Easily manage multi-touch phases for iPhone.
  • 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.
  • Interpolate - Interpolation utility functions for easing, Bezier splines, and Catmull-Rom splines.
  • LABColor - This utility script provides an LAB color model. Lab color is designed to approximate human vision and so it aspires to perceptual uniformity.
  • 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.
  • MazeGenerator - Randomly generates a maze.
  • MD5 - Generate an MD5 hash for a string.
  • MeshMerger - Draw a large number of meshes with a single draw call.
  • MetadataSystem - Mechanism for ciphered, compressed preferences and declarative metadata system with runtime overrides.
  • MixupGO - Flatten GameObjects and all attached components into a single object using duck typing in Unity Javascript.
  • 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.
  • PolyContainsPoint - Like Rect.Contains, except instead of a rect, you can define any arbitrary polygon.
  • 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.
  • Set - A set data structure.
  • Shell - A replacement for the built-in shell function removed from Unity 1.6.1.
  • Simple Timer Class - A basic timer class with formatting for time displays in game etc.
  • SpeedLerp - Replacements for Mathf.Lerp, InverseLerp, SmoothStep, etc. that are typically 1.5X faster or more. Also adds Vector2Lerp and SuperLerp.
  • 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.
  • 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.
  • Triangulator - A utility class for splitting a 2D polygon into triangles.
  • Tween - An adaptation of the Tweener class of FLASH for unity.
  • 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.
  • VertexInfo - Displays the vertex numbers of a mesh at the runtime.
  • LanguageFilter - Removes badwords from strings using regular expressions.

Really Simple Scripts

  • ConstantVelocity - Set a local velocity to an object (useful for missiles perhaps?)
  • 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.
  • OnMouseDown - Sends OnMouseDown messages on an iPhone.
  • SwitchCamera - Switches between cameras in your scene.
  • PointerManager - Hides the mouse pointer when it is not in use.

Code Snippets

  • 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.

Controllers

Camera Controls

  • CrossFade - Smoothly fade the view from one camera to another.
  • CrossFadePro - Smoothly fade the view from one camera to another, with motion in both cameras.
  • DreamWipe - Fade the view from one camera to another, with the wavy distortion seen with dream sequences or flashbacks
  • FadeInOut - Fade a full-screen image in or out, good for fade in outs.
  • Headbobber - Make an object bob up and down smoothly when you're pressing one or both of the horizontal/vertical axes.
  • MouseLookPlus - A javascript mouselook with key control. based on the standard assets C# mouselook.
  • MouseLookPlus2 - A modification of MouseLookPlus to allow for moving and strafing the camera.
  • OffsetVanishingPoint - Sets the vanishing point of a camera to an arbitrary position.
  • RectangleWipe - Make an animated rectangular zooming screen wipe from one camera to another.
  • ShapeWipe - Make an animated screen wipe, where an arbitrary shape containing the second view zooms in or out, and rotates.
  • SmoothFollow2 - This is designed to make a camera smoothly follow a ship in space.
  • SquishWipe - Make an animated screen wipe from one camera to another, where the first image is squished out of view.
  • StaticBackground - Use a static image as the background to your 3d scene.
  • MouseOrbitImproved - Improved version of the original MouseOrbit script. Zooms with the mousewheel and uses linecast to make sure that object isn't behind anything.
  • MouseOrbitZoom - A camera that combines orbiting zooming and panning, initially set up to mimic the 3dsMax camera controls.

Character Controller Scripts

  • A* Pathfinding - An A* pathfinding-system for out-of-the-box pathfinding in Unity.
  • AimDownSights - An expansion script for the FPSWalker that smoothly animates aiming down the sights of an attached gun model.
  • Biped Parts Finder - Editor script for search simplification of parts of a biped body.
  • DoubleJumpController - A hack for the 2d gameplay tutorial character controller script, it allows the character to make a second jump when jumping, or make a little jump when falling.
  • Force2D - Constrain a GameObject to move in two dimensions.
  • FPSWalkerEnhanced - Adds features to standard FPSWalker, such as sliding down slopes, falling damage, and walk/run modes
  • Gesture_Recognizer - A math based gesture recognition script.
  • GridMove - A controller for character movement typically seen in old-school 2D RPGs and strategy games.
  • HeadLookController - A component that can be used to make a character look towards a specified point in space, smoothly turning towards it with for example the eyes, head, upper body, or whatever is specified.
  • JCar - A car using wheel colliders.
  • KeyCombo - A class that can be used to detect fighting-game style combos.
  • LookAtMouse - Cause an object to rotate toward the cursor, along the y axis.
  • Pathfinding - [Old] A pathfinding-system using raycasting to avoid obstacles
  • PhysicsFPSWalker - Another physics based fps walker script.
  • RigidbodyFPSWalker - An physics based FPS walker that works with rigidbodies and thus is affected by forces, joints or other rigidbodies
  • SeekSteer - A class that can be used to move an object to follow a loose path of waypoints
  • ShipControls - Place this script on a RigidBody for 2D spaceship controls like OverWhelmed Arena.
  • VariableSpeedFPSwalker - An FPS walker script having different speeds for walking forward, strafing, and back-pedalling.
  • WaypointMaster - Implementation of A* algorithm, based on waypoints.

Animation Controllers

  • AniMate - Script to quickly and easily create animations/tweens of almost any value and including eased, rigidbody and rotation animation.

GUI

Graphical User Interface Scripts

  • AutoType - Automaticly types a string of text typewriter style.
  • 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.
  • Button - Use this script on a guiTexture object for regular push buttons that send a message when clicked.
  • Custom_2D_Pointer - Make a custom pointer that changes shape at the edges of the screen.
  • DraggableGUIElement - Click and drag on GUITexture or GUIText to move it around the screen.
  • DragSlider - Use this script with a pair of GUITextures to make a functioning slider.
  • Fade - General routines that allow fading of GUITextures or materials (including GUITexts) from anywhere, both in and out and using either alpha or colors, with optional easing.
  • FadeIn - Allows you to show/hide a GUIText or GUITexture when pressing a key/button.
  • ForwardAllMouseEvents - Send mouse events to some sort of controller type GameObject.
  • GetTimeString - A simple function that can be placed anywhere and used to display times. Useful for racing games.
  • GUIBuilder - Generic classes for easing the pain of GUI creation. (BETA)
  • GUIFly - Use this script on an object to make it respond to a "Fly" message so that it may move on and off the screen in a pleasing manner.
  • GuiRatioFixer - Use on a GUIText / GUITexture object to automatically adjust aspect ratio
  • GuiRatioFixer2 - Alternate script based on screen's aspect to use on a GUIText / GUITexture object to automatically adjust aspect ratio
  • GUIScaler - Automatically scale a GUITexture with the screen size / resolution
  • ObjectLabel - Makes a GUIText label follow an object in 3D space. Useful for things like having name tags over players' heads.
  • ScreenShotMovie - Captures a screenshot sequence for use when making a movie
  • splashScreen - fade logo in out, load new level.
  • TakeScreenshot - Captures sequentially numbered screenshots when a function key is pressed.
  • Texture swap animator - Feed it a bunch of materials and it will cycle through them. Useful for simple animations not on a texture atlas.
  • Timer - Attach to a GUIText object to create a fade-able timer.
  • ToggleButton - Extends the Button class to create a toggle button.
  • MainMenu - Shows how delegation works in C# in order to switch between different menus on the fly easily

Unity 2.0 GUI Scripts

  • Blinking Text Entry Cursor - Make your cursor blink on input fields
  • DrawLine - Draws a line in the GUI (makes up for the severe lack of an equivalent function in the GUI class).
  • FileBrowser - Implement a crude file browser.
  • CustomGetMouseButtonDown - custom wrapper functions for Input.GetMouseButton(Down) which can be modified to block clicks when over a window
  • Position To Rect - Convert a GUITexture position to Rect (GUI coordinates)
  • GUICam - Holds GUIRect a rectanle of camera pixelRect in GUI oriented co-oridinates (0,0) is top left
  • GUIx - extended GUI functions
  • PasswordField - Allows the user to type in a field masked by *'s (or any other character)
  • PauseMenu - Standard pause menu used by Fugu Games for web players and widgets
  • SelectList - A list of elements of which one can be selected.
  • WithPrefs - Functions that change values and modifies preferences in one simple step

Heads Up Display Scripts

  • FramesPerSecond - Use this script on a GUIText object to display FPS counter.
  • MessageDisplayer - Use this script on a GUIText object to have a self-disappearing list of status messages.
  • MessageList - Create a list of timed self-fading messages.
  • Radar - Use this script on a GameObject to display a radar.

Effects

General Purpose Effect Scripts

  • Animating Tiled texture - A texture made of many tiles animated through setting the uv offsets
  • Animating Tiled texture - Extended - Use one animation cell-sheet texture for many animations and skins.
  • CameraFacingBillboard - Use this script on a billboard or similar object to make it align itself with the camera.
  • CameraRenderSettings - Allows storing seperate render settings per camera - an extended version of the Fog Layer script above.
  • Character Shadow - Cast shadows from an object! (requires Unity Pro)
  • Flocking - A flocking script with randomness and target following.
  • Fog Layer - Lets you determine per camera if fog should be enabled or disabled
  • LookAtCameraYonly - Use this script on a billboard or other object to have it face the camera but only rotate on the Y axis.
  • MeshMorpher - A Mesh Morpher script with scripting API
  • MetaBalls - 3D Metaballs
  • MarchingSquares - MarchingSquares (2D Surface Reconstruction)
  • MorphTargets - Improved MeshMorpher script with multiple blendable targets
  • OptimizedTrailRenderer - Started from Yoggy's trail renderer above, this one updates every frame and is built for one-time use.
  • Particle Spiral Effect - Particle effect script for creating spirals, whirlpools, galaxies, etc.
  • Perlin Noise - Noise functions for smoothly moving objects around or anything else
  • ReverseNormals - Reverses normals & back face culling of a mesh
  • SetRenderQueue - Sets the render queue for transparency sorting on an object or all of its children.
  • Shadow Volumes in Alpha - Shadow volume based shadows (requires Unity Pro)
  • SoftBodies - Cloth, Springy Noodles, Jello Blocks, etc..
  • StopEmittingAfterDelay - After a configurable delay, particles will fade naturally, then finally the object will get destroyed with autodestruct.
  • Spline Controller - Interpolates any GameObject along a user-defined spline
  • SVG - Render SVG Files.
  • TextureMask - A simple shader for masking off areas of a texture.
  • TubeRenderer - LineRenderer too flat? Make it a tube instead.
  • TimeBasedTrailRenderer - The Built in trail renderer does not fade its segments based on the time they have been alive. This one does.
  • Trail Arc Renderer - Designed for melee trail swings, this creates a trail using Catmull-Rom spline interpolation
  • Underwater Script - Simple underwater effects script. Works with indie!
  • VectorLine - Renders a 2D vector line with an arbitrary width, color, and number of segments (requires Unity Pro)
  • LineRenderer Rope - Creates a rope using physics and the LineRenderer component.
  • 3D Physics Based Rope - Creates a rope using physics and the TubeRenderer (Use included modified code).
  • Flickering Light - Adds flickering effect to Light object. Flicker styles are Campfire and Fluorescent.

Image Postprocessing Effects

These scripts require Unity Pro.

  • BloomEffect (OBSOLETE) - Sometimes referred to as "glow", use this effect to make bright parts in your scene bleed. This script is made obsolete by the GlowEffect shipped with Unity 1.5.
  • BoostColors - A very simple and fast way to boost the contrast of saturation of the graphics in your game.
  • InvertCamera - A simple script that will invert everything rendered by a camera.


Physics / Simulation

Physics Scripts

Simulation Scripts

  • Compass - This script simulates a compass with North relative to the Z axis of a reference object
  • GameTime - This script rotates a directional light to match the rotation of the sun based on the system time.
  • sunLight - A script that rotates a directional light based on longitude/latitude.
  • GPS Global Positioning System - This script simulates a GPS device providing real world GPS locations based on a reference point
  • Gravity - Simulates body-to-body gravity (i.e. planetary gravity)
  • 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.
  • SICK Laser Scanner - This script simulates the SICK LMS type planar laser scanner
  • Trajectory Simulation - Demonstrates simulating the trajectory of a launched object
  • OpenStreetMap for unity iPhone - A simple OpenStreetMap script for unity iPhone
  • Simple planetary orbits - Visually define the orbital path of one object around another fixed object, like a planet around the sun

Networking

  • NetworkView_Position_Sync - Network position interpolation, extrapolation, packet timestamp preservation and more in non-authoritative applications

WWW Scripts

  • CookieCutter - Access browser cookies from Unity web players.
  • GetXMLHack - Get XML data into the web player using browser script instead of WWW() (which has been buggy for me!)
  • MeshSerializer2 - Save Unity meshes to files for the Web, load them with WWW interface.
    • MeshSerializer - an old version of the same (simpler format, but larger file sizes)
  • 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.
  • 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.
  • UnityObject - A nice & clean way to embed .unityweb in your web browser. Plugin Detection, Communication, Clean HTML
  • 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.

Unity 1.x Networking Scripts

  • 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.
  • Sender - Uses a Server to send data from the parent object to whatever is on the other end of the connection.
  • Server - TCP network host, based on NetworkCursor, but expanded to do more.
  • 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

Sound

  • JukeboxController - A very basic jukebox class. This can be used to manage multiple audio clips across different levels.
  • Audio - Better control of Audio Sources
  • Listener - Better control of Audio Listener volume

Development

Debugging Scripts

  • DetectLeaks - a simple GUI script for displaying the amount of objects currently loaded by type
  • DebugConsole - A script to allow scrolling feedback from your scripts.
  • DebuggerX - A simple javascript singleton that allows you to send debug to the console or the GUI
  • Profiler - a simple c# script for profiling the performance of scripts, based on tags
  • Reporter - a simple delayed action system info script that could be used for support purposes
  • UUnit - a Simple xUnit framework that can be run inside Unity.

Performance Scripts

  • StaticPerformanceOptimization - A script that optimizes performance statically based on the users graphics card by dropping terrain resolution and quality settings
  • SpriteManager - A script that allows many independently-moving 2D sprites to be drawn using a single draw call. This is particularly useful to increase iPhone performance.
  • CombineSkinnedMeshes - A Script that allows to combine multiple skinned meshes to just one SkinnedMeshRenderer. Useful for Avatar System!
  • SkinMeshCombineUtility - Script to work with CombineSkinnedMeshes.
  • CombineChildrenBones - Similar to MeshMerger, this script combines MeshFilter meshes into a single skinned mesh and then tracks transform changes

Editor Scripts

  • HierarchySelectObject - Editor script that automatically selects and scrolls to the desired gameObject in the hierarchy window.
  • TextureImportSettings - Editor script to change texture import settings for multiple textures at once.
  • iPhoneTextureImportSettings - iPhone specific script to change texture import settings for multiple textures at once.
  • AddChild - Adds an empty GameObject as a child of each selected object.
  • AddComponentRecursively - Adds a component to an object, and all the children of that object.
  • AutoMeshCollisionCreator - Automatically convert mesh from 3D Package into Mesh Collider on Import.
  • CopyTransform - Copies the local transform of the selected game instance in the scene and then pastes it into another one you select.
  • CountLines - Count all the files and lines in your project
  • Create project directories - Simple script which creates various directories under your Assets folder, best used when creating a new project.
  • DeleteComponentsInChildren - Helps to delete a special type of components which are attached to the children of the selected Gameobject.
  • ExportVisualStudio - Creates Visual Studio 2005, 2008 and 2010 projects. Designed for minimal friction for non-techy people.
  • FbxAnimListPostprocessor - Import a list of splitted animations for FBX 3D models.
  • FindObjects - Find objects by name or attached component type.
  • GetSize - Get the size in game units of a selection.
  • HeightmapFromTexture - Applies a selected texture as a heightmap to the active terrain.
  • HeightmapFromGridFloat - Applies the selected GridFloat file (topo data from USGS seamless server) as a heightmap to the active terrain.
  • InsertParent - An alternative to the built-in Make Parent command, this script inserts a new GameObject which becomes the parent of all selected objects.
  • MoveToOrigin - Moves the selected GameObject(s) to (0, 0, 0).
  • MultipleObjectsToLayer - an editor utility that lets you move multiple selected objects into a layer at the same time.
  • Normalize - Normalize terrain
  • Notes - Allows you to add notes to any GameObject.
  • OpenVisualStudioProject - Open the current visual studio project (To launch Express).
  • Object2Terrain - Convert a standard mesh object to a Unity terrain.
  • PixelLightMapper - A pixel based light mapper for Unity.
  • RaiseHeightmap - Raises or lowers the entire terrain by a specified amount.
  • WorldUVs - UV maps meshes in world space, allowing textures in separate meshes to seamlessly line up with each other.
  • SaveFontTexture - Saves auto-generated bitmaps that Unity makes from vector fonts as .png files so they can be edited externally
  • Skybox Generator - Generates the 6 images necessary to create a Skybox in Unity. (Pro Version Only)
  • SnapToGrid - Snaps objects to a grid in 3 dimensions.
  • Take3DScreenshot - Take a "3d screenshot"; a series of screenshots captured while rotating around a given object. Useful for QTVR creation.
  • TerrainObjExporter - Exports Unity terrain objects as .obj files.
  • TransformUtilities - Includes tools to Align objects, copy, randomize and add noise to their transforms.
  • ToggleActiveRecursively - Activates/deactivates entire hierarchies at once.
  • ToggleActiveRecursivelyAllGameObjects - Activates/deactivates entire hierarchies at once and for all selected game objects.
  • Camera view window - Shows the rendered image of any camera that has this script on, the window is displayed inside the scene view.
  • MassSetMaterials - Sets the materials of all selected objects simultaneously.
  • MassMaterialEditor - Affect the some settings of the RenderSettings and Materials of selected objects simultaneously.
  • HierarchyFastHide - Makes list in window of game objects that have Mesh Renderer and adds toggle for user to turn it on and off. In Alpha State, but working with some limitations.

External Links

Personal tools
Namespaces

Variants
Actions
Navigation
Extras
Toolbox