- Home /
 
               Question by 
               Ipwndthebeast · Jan 29, 2014 at 07:27 PM · 
                errorcursor  
              
 
              whats wrong with my code?
i get the error Assets/Scripts/CursorGone.cs(12,9): error CS0246: The type or namespace name `function' could not be found. Are you missing a using directive or an assembly reference? and it higlights the function update.
using UnityEngine; using System.Collections;
 public class CursorGone : MonoBehaviour 
 {
 
     function Start ()
     {
         Screen.showCursor = false;
     }
     
     function Update () 
     {
         if (Input.GetKey (KeyCode.Tab))
         {
             Screen.lockCursor = false;
             Screen.showCursor = false;
         }   
         else
         {
             Screen.lockCursor = true; 
             Screen.showCursor = true;
         }
     }
 }
               Comment
              
 
               
              Answer by Domo23000 · Jan 30, 2014 at 12:36 AM
 function Start ()
 {
     Screen.lockCursor = false;
 }
  
 function Update ()
 {
     if (Input.GetKeyDown (KeyCode.Tab))
     {
         if(Screen.lockCursor == true)
         {
             Screen.lockCursor = false;
         }
         else
         {
             Screen.lockCursor = true;
         }
     }
 }
Try this. also, Screen.lockCursor also hides the mouse so you dont need Screen.showCursor
Your answer
 
 
             Follow this Question
Related Questions
Multiple Cars not working 1 Answer
No appropriate version of 'UnityEngine.Object.Instantiate. Please Help :( 1 Answer
"Expecting ), found ';'" and "';' expected. Insert a semicolon at the end" 1 Answer
Animation spins wildly after completed 0 Answers
Scripting Error! - UCE0001: ';' expected. Insert a semicolon at the end. 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                