Top-Down 2D game:How to make the camera move on hitting the sides of the screen?

Hi guys! I’m trying to make a topdown 2D game so that I can learn Unity :slight_smile:
So far i’ve made the character, the map and some other stuff but i’m having trouble with the camera.
How can i make the camera move only when the player moves the mouse to the sides of the screen, without the unit chasing/moving/rotating towards the mouse?

P.S.:I tried finding other questions or close functions but i didn’t find a lot of useful stuff/info.

Expanding on the comment : you need to check if the mouse position is within a certain distance from an edge, then affect your character accordingly. Have a look at Input.mousePosition , Screen.height and width :

http://unity3d.com/support/documentation/ScriptReference/Input-mousePosition.html

http://unity3d.com/support/documentation/ScriptReference/Screen-height.html

http://unity3d.com/support/documentation/ScriptReference/Screen-width.html

: Create a New Scene, then Create a Cube. Attach this Script to the Cube and hit Play.

#pragma strict

public var Boundary : int = 50;
public var speed : int = 5;

private var theScreenWidth : int;
private var theScreenHeight : int;

function Start() 
{
	theScreenWidth = Screen.width;
	theScreenHeight = Screen.height;
}

function Update() 
{
	if (Input.mousePosition.x > theScreenWidth - Boundary)
	{
		transform.position.x += speed * Time.deltaTime;
	}
	
	if (Input.mousePosition.x < 0 + Boundary)
	{
		transform.position.x -= speed * Time.deltaTime;
	}
	
	if (Input.mousePosition.y > theScreenHeight - Boundary)
	{
		transform.position.y += speed * Time.deltaTime;
	}
	
	if (Input.mousePosition.y < 0 + Boundary)
	{
		transform.position.y -= speed * Time.deltaTime;
	}
	
}	

function OnGUI() 
{
	GUI.Box( Rect( (Screen.width / 2) - 140, 5, 280, 25 ), "Mouse Position = " + Input.mousePosition );
	GUI.Box( Rect( (Screen.width / 2) - 70, Screen.height - 30, 140, 25 ), "Mouse X = " + Input.mousePosition.x );
	GUI.Box( Rect( 5, (Screen.height / 2) - 12, 140, 25 ), "Mouse Y = " + Input.mousePosition.y );
}

there is a plugin called Univerture, check it out