So I have only really coded small things in Java and actionscript in the past and I am hoping to really learn C#.
I am an artist but I want to expand my skill set and start creating a small game in unity, creating all the assets on my own.
I will be posting a plethora of questions about different scripts and will continue to update as I learn and anything I figure out on my own i will update with my own answers so this thread will help anyone else in the same situation I am in hopefully.
My first question is about setting camera scripts. I want the camera to move by mousing to the edges of the screen and to be set up in an isometric fashion. (I am planning to make the character move with WASD, which I already have a small start on.)
So how would I go about setting up the camera to move with the mouse, and also I suppose I would need to set up a script that locks the mouse into the play window. Any suggestions on where I should start.
fixed the old issue so just made an edit for the new one since the old one was simple.
the new error
at (35, 17) cameramove update is already defined. rename.
using UnityEngine;
using System.Collections;
public class Cameramove : MonoBehaviour {
//mouselock
void DidLockCursor() {
Debug.Log("Locking cursor");
guiTexture.enabled = false;
}
void DidUnlockCursor() {
Debug.Log("Unlocking cursor");
guiTexture.enabled = true;
}
void OnMouseDown() {
Screen.lockCursor = true;
}
private bool wasLocked = false;
void Update() {
if (Input.GetKeyDown("escape"))
Screen.lockCursor = false;
if (!Screen.lockCursor wasLocked) {
wasLocked = false;
DidUnlockCursor();
} else
if (Screen.lockCursor !wasLocked) {
wasLocked = true;
DidLockCursor();
}
}
//Get the Cursor Position
void Update () {
transform.position = new Vector3(Input.mousePosition.x,
Input.mousePosition.y,
Input.mousePosition.z);
}
}
i split up the mouse lock into its own script now. It makes sense to do that correct?