Unity Mouse_Input (C#)
This is a basic mouse input class to be customized for a particular game’s needs and loaded depending on device. Note that unlike the Keyboard_Input class, this requires tweaking the Input Manager in the project settings since the default are not fully compatible with this (in my opinion) more optimized script.
Mouse_Input.cs
using UnityEngine;
using System.Collections;
public class Mouse_Input : BaseInputController {
   private Vector2 prevMousePos;
   private Vector2 mouseDelta;
  Â
   private float speedX = 0.05f;
   private float speedY = 0.1f;
  Â
   public void Start () {
      prevMousePos= Input.mousePosition;
   }
  Â
   public override void CheckInput () {
      // get input data from vertical and horizontal axis and store them internally in vert and horz so we don't
      // have to access them every time we need to relay input data out
     Â
      // calculate a percentage amount to use per pixel
      float scalerX = 100f / Screen.width;
      float scalerY = 100f / Screen.height;
     Â
      // calculate and use deltas
      float mouseDeltaY = Input.mousePosition.y - prevMousePos.y;
      float mouseDeltaX = Input.mousePosition.x - prevMousePos.x;
     Â
      // scale based on screen size
      vert += ( mouseDeltaY * speedY ) * scalerY;
      horz += ( mouseDeltaX * speedX ) * scalerX;
     Â
      // store this mouse position for the next time we're here
      prevMousePos= Input.mousePosition;
     Â
      // set up some boolean values for up, down, left and right
      Up   = ( vert>0 );
      Down   = ( vert<0 );
      Left   = ( horz<0 );
      Right   = ( horz>0 );  Â
     Â
      // get fire / action buttons
      Fire1= Input.GetButton( "Fire1" );
   }
  Â
   public void LateUpdate() {
      // check inputs each LateUpdate() ready for the next tick
      CheckInput();
   }
}
Next Up: MusicManager.cs
Many games have background music. The Music Manager is a singleton in charge of making sure music loads and is played when needed.
