Useful Unity Scripts

This is a collection of simple scripts for Unity. It should be easy for you to inspire from and modify, depending on your needs.

 

Camera Control Script

A simple script to control a camera with mouse+keyboard. Works to test your HMD app in the editor. Add a camera, tag it as Main Camera. Attach the script to it and disable the OVRPlayerController. You can now hit play in the editor and move around your scene using the mouse and the "wasd" keys. To deploy the app to the headset, disable the new camera and enable the OVRPlayerController.

 

Simple object rotation around another object

This scripts rotates the object it is attached to. The speed is a parameter, the rotation center is given by a GameObject (the object being a parameter). Drag and drop a scene object (3d mesh, camera, light or any) to the script's Rotation Pivot field.

 

Script collections

As you can guess, some people made collections of useful scripts for Unity development. Here are the best two I found:

https://github.com/michidk/Unity-Script-Collection#controls--input

http://www.procedural-worlds.com/blog/best-free-unity-assets-categorised-mega-list/

 

Shaders

The base Unity shaders may not be enough, depending on your needs. It can be completed with some free shader collection available in the Asset Store:

- double sided shaders

- other free shaders