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 1Elfo · Apr 11, 2015 at 10:02 AM · errorcs1502cs1503

ERROR CS0199, ERROR CS1502, ERROR1503

Hello, I´m trying to make a menu for android and I´m trying to get a ray from a touch to tell me if the button is touched, but I get the ERROR CS0199 in the first line I´ll point out and the other another ERROR CS0199 in the second plus the other 2 errors. Since I´m translating from .js to .cs I guess I´ve ,missed something in the process. I´m not an expert in the programing field, so any help is very much apreciated. Thanks for the help in advanced.

This are the error codes I get:

  1. Assets/Test/ScriptsTest/MenuControl.cs(15,51): error CS0119: Expression denotes a method group', where a variable', value' or type' was expected

  2. Assets/Test/ScriptsTest/MenuControl.cs(19,44): error CS0119: Expression denotes a type', where a variable', value' or method group' was expected

  3. Assets/Test/ScriptsTest/MenuControl.cs(19,36): error CS1502: The best overloaded method match for UnityEngine.Physics.Raycast(UnityEngine.Vector3, UnityEngine.Vector3, float)' has some invalid arguments 4. Assets/Test/ScriptsTest/MenuControl.cs(19,36): error CS1503: Argument #1' cannot convert object' expression to type UnityEngine.Vector3'

And here is my code:

using UnityEngine; using System.Collections;

public class MenuControl : MonoBehaviour {

 public GameObject videosButton;

 public GameObject optionsButton;

 public GameObject exitButton;
 
 // Update is called once per frame
 void Update () {

     if (Input.touchCount > 0 && Input.GetTouch.phase == TouchPhase.Began) { /*<== 1st Error */
     
         RaycastHit hit;

         if(Physics.Raycast(Ray, out hit, 100f)){ /* <== other 3 Errors */

             GameObject buttonTouched = hit.transform.gameObject;

             if(buttonTouched.tag == "Videos"){



             }

             if(buttonTouched.tag == "Options"){



             }

             if(buttonTouched.tag == "Exit"){

             
             
             }

             if(buttonTouched.tag != "Videos" && buttonTouched.tag != "Options" && buttonTouched.tag != "Exit"){

                 return;

             }


         }
     
     }
 
 }

}

Comment
Add comment · Show 1
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 gjf · Apr 10, 2015 at 12:57 PM 0
Share

check the syntax for GetTouch

1 Reply

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

Answer by Oribow · Apr 11, 2015 at 12:26 PM

You have make an instance of Ray. Ray is a class and classes must be instantiated before use.

Ray ray = new Ray (some Variables)

Comment
Add comment · Show 3 · 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 1Elfo · Apr 13, 2015 at 07:35 AM 0
Share

Thanks, altho I still get other errors, but I´ll try to sort them out with other entries

avatar image Oribow · Apr 13, 2015 at 02:44 PM 0
Share

The last if in your code is unecesseary. GetTouch is a methode. $$anonymous$$ethodes are called with (some variables). Write GetTouch(0). The 0 tolds the methode which touch to give back. this should correct all errors. Sorry for the late answer.

avatar image 1Elfo · Apr 15, 2015 at 07:41 AM 0
Share

thank yet again, much appreciated, altho I fixed it using this code and adding collider to the buttons:

using UnityEngine; using System.Collections;

public class $$anonymous$$enuControl : $$anonymous$$onoBehaviour {

 float timerExit;

 int counterExits;

 public float maxTimeExit = 2.0f;

 void Update () {

     foreach( Touch touch in Input.touches ){

         if( touch.phase == TouchPhase.Began ){

             Ray ray = Camera.main.ScreenPointToRay(new Vector3(touch.position.x, touch.position.y, 0));

             RaycastHit hit;

             Physics.Raycast(ray, out hit, 100);

             if (hit.collider != null){

                 if(hit.collider.gameObject.tag == "Videos"){

                     Application.LoadLevel("Videos");

                     Debug.Log("LoadVideos");

                 }

             }

             if(hit.collider.gameObject.tag != "Videos" && hit.collider.gameObject.tag != "Options" && hit.collider.gameObject.tag != "ExitYes"){
                     
                 Debug.Log("NothingAtAll");

                 return;
                     
             }
                 
         }                                    
         
     }

     if (Input.Get$$anonymous$$eyDown($$anonymous$$eyCode.Escape)){ 
         
         counterExits = counterExits + 1;
         
         if(counterExits <= 1){
             
             Debug.Log ("Press again");
             
         }
         
         if(counterExits >= 2){
             
             Debug.Log("ESCAPE!!!!");
             Application.Quit(); 
             
         }
         
     }
     
     if(timerExit >= maxTimeExit){
         
         counterExits = 0;
         
     }
     
     timerExit = timerExit + Time.deltaTime;
     
     if(counterExits == 0){
         
         timerExit = 0.0f;
         
     }
     
 }

}

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

Error CS1525 calling OntriggerEnter 1 Answer

Whats wrong with my script? GUI C# 2 Answers

error with GUI in c sharp 2 Answers

Fixed but there is still one error (see code for error) help please :) 1 Answer

error CS1502 and error CS1503 What is this? 1 Answer


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