Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 tushi · Jul 17, 2017 at 11:16 PM · cs0246

Error code CS0246

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.EventSystems;
 
 public class ButtonControl : IPointerEnterHandler, IPointerExitHandler 
 {
     private GameObject childText = null; //  or make public and drag
     void Start(){
         Text text= GetComponentInChildren<Text>();
         if (text != null) 
         {
             childText = text.gameObject;
             childText.SetActive(false);
         }
     }
     public void OnPointerEnter(EventSystems.PointerEventData eventData)
     {
         childText.SetActive(true);
     }
     public void OnPointerExit(EventSystems.PointerEventData eventData)
     {
         childText.SetActive(false);
     }
 }

 

im using this script so that when i highlight the button it shows some text, but i keep getting error code CS0246. It says that 'EventSystems' could not be found and asks if im missing an assembly reference. i have searched this up but couldnt find anything that helped. they are mostly other scripts that dont relate to my game.

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 tushi · Jul 19, 2017 at 11:37 PM 0
Share

so, this function isnt so important but i would like it in my script. i got i from here: [1]: http://answers.unity3d.com/questions/1025135/how-to-make-text-appear-only-when-over-buttonhighl.html?_ga=2.174713378.182906120.1500506428-1905419412.1499251455 im very sorry for troubling everyone but i really need help because i am horrible at coding. Thanks

3 Replies

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

Answer by Zendist · Jul 17, 2017 at 11:26 PM

Remove EventSystems from the function argument types:

 public void OnPointerEnter(PointerEventData eventData)
 {
     childText.SetActive(true);
 }
 public void OnPointerExit(PointerEventData eventData)
 {
     childText.SetActive(false);
 }
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
avatar image
0

Answer by tushi · Jul 18, 2017 at 07:44 AM

i fixed it up and then i got some more errors. if fixed them and then i got this: Assets/Shake.cs(13,48): error CS1525: Unexpected symbol `)'

i currently have this script: using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI;

 public class Shake : MonoBehaviour {
 
     public class ButtonControl : IPointerEnterHandler, IPointerExitHandler 
     {
         private GameObject childText = null; //  or make public and drag
         void Start(){
             Text text= GetComponentInChildren<"Text(3)">();
             if (text != null) 
             {
                 childText = text.gameObject;
                 childText.SetActive(false);
             }
         }
         public void OnPointerEnter(PointerEventData eventData)
         {
             childText.SetActive(true);
         }
         public void OnPointerExit(PointerEventData eventData)
         {
             childText.SetActive(false);
         }
     }
 }

i got rid of the problem but then i got another one, and if these problems continue, i will end up with nothing. PLEASE HELP!!! Thanks. :)

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
avatar image
0

Answer by ZeN12 · Jul 18, 2017 at 07:52 AM

Check in your scene if you have an object EventSystem with script attached EventSystem. It requires to be in order to work with uGUI.

Comment
Add comment · Show 2 · 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 tushi · Jul 19, 2017 at 11:26 PM 0
Share

i dont know what that is :( i am only new to coding and unity. and whats an EventSystem? i got this script from another question and i dont understand c sharp as well as java.

avatar image tushi · Jul 19, 2017 at 11:29 PM 0
Share

right now it says that there is an unexpected symbol (error code CS1525) and that is ')'. the code looks fine.

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.UI;
 
 public class Shake : $$anonymous$$onoBehaviour {
 
     public class ButtonControl : IPointerEnterHandler, IPointerExitHandler 
     {
         private GameObject childText = null; //  or make public and drag
         void Start(){
             Text text= GetComponentInChildren<"Text(3)">();
             if (text != null) 
             {
                 childText = text.gameObject;
                 childText.SetActive(false);
             }
         }
         public void OnPointerEnter(PointerEventData eventData)
         {
             childText.SetActive(true);
         }
         public void OnPointerExit(PointerEventData eventData)
         {
             childText.SetActive(false);
         }
     }
 }












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

69 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Disabling a Script with C# 3 Answers

error CS0246: type/namespace name `GameDate' couldn't be found. 1 Answer

Can´t add Imageeffect-component at runtime.. Namespace? 1 Answer

Error CS0246: Type/Namespace Error 3 Answers

typedefing in unity 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