Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by misko96 · Dec 31, 2013 at 02:24 PM · var type

Mouse cursor - Please Help

Hi, i have problem with mouse cursor, it is invisible in start, and i want that it appears when i press ecs button, i made this script :

 static var showCursor :bool ;
 function Start () {
 Screen.showCursor = false;
 }
 
 function Update () {
 if( Input.GetKey(KeyCode.Escape));
 Screen.showCursor = true;
 }


but is showing me this error: Assets/Player.js(2,25): BCE0018: The name 'bool' does not denote a valid type ('not found').

Can anybody help me?

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by deltamish · Dec 31, 2013 at 02:54 PM

Hi try this

 #pragma strict //Add this very Important
 
 public var ShowCursor:boolean = false; // <-- See changes i made cahnged from bool(C# syntax) to boolean(JS syntax)
 
 
 function Start () {
 Screen.showCursor = false;
 Screen.lockCursor = true; 
 }
 
 function Update () {
 if( Input.GetKeyDown(KeyCode.Escape))// <-- Dont add ; at end of an if statement
 {
 ShowCursor = !ShowCursor;//Toggle   
 }
 Screen.showCursor = ShowCursor;
 Screen.lockCursor = !ShowCursor;///set lock to false when mouse cursor enaled and vice versa
 }
Comment
Add comment · Show 9 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image misko96 · Dec 31, 2013 at 03:21 PM 0
Share

none of these doesnt work, i want to it work in .exe file, bcs when i press esc it shows menu but i cant press anything :(

avatar image deltamish · Dec 31, 2013 at 04:00 PM 0
Share

did you try pressing Escape again and again i am sure that this script works as i am using it in my current project as well

avatar image misko96 · Dec 31, 2013 at 04:07 PM 0
Share

i tried now, but it still doesnt work, i dont know if this is important, but my script doesnt show any conection between these 3 ShowCursor

avatar image deltamish · Dec 31, 2013 at 04:16 PM 0
Share

what do you mean by

conection between these 3 ShowCursor

avatar image misko96 · Dec 31, 2013 at 04:50 PM 0
Share

I dont know, it is stupid, i noticed that if some word is on more playes if u press on one of them it shows and others with backround color, and in your script ShowCursor is colored, and $$anonymous$$e is not, but its stupid, I dont know is it maybe bcs I think I did something for cursor in my another script, so i will now try to erase it

Show more comments
avatar image
0

Answer by sparkzbarca · Dec 31, 2013 at 02:27 PM

static var showCursor :bool ;

get rid of that line.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image misko96 · Dec 31, 2013 at 02:33 PM 0
Share

now there is no error but it is not working

avatar image
0

Answer by RudyButzke · Dec 31, 2013 at 02:58 PM

 var showCursor :boolean;
 function Start () {
 Screen.showCursor = false;
 }
  
 function Update () {
 if( Input.GetKey(KeyCode.Escape));
 Screen.showCursor = true;
 }
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

21 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Codes unavailable in C# 0 Answers

Why is Unity deleting my prefabs!? 1 Answer

2D Border doesnt allow the nutbomb gameobject to bounce 0 Answers

Object reference not set to an instance of an object 0 Answers

camera movments fixed.. character controller without using character controller -.-' 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges