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
-4
Question by AnaRhisT · Jul 14, 2010 at 10:46 PM · variabletypegroupcs0119

Expression denotes a `type', where a `variable', `value' or `method group' was expected

Got an error : Expression denotes a type', where avariable', value' ormethod group' was expected

This error is at the list line of this script(in the if(Popup.List...) line) In this Col : " GUIContent("Filer") " If I do new GUIContent it gives me 2 new errors: (also in if(Popup.List...) line)

The best overloaded method match for `Popup.List(UnityEngine.Rect, ref bool, ref int, UnityEngine.GUIContent, UnityEngine.GUIContent[], UnityEngine.GUIStyle)' has some invalid arguments

Argument 2: Cannot convert type bool' to bool&'

The script "Popup.cs" is that one :

using UnityEngine;

public class Popup { public static bool List (Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent, GUIContent[] listContent, GUIStyle listStyle) { return List(position, ref showList, ref listEntry, buttonContent, listContent, "button", "box", listStyle); }

 public static bool List (Rect position, ref bool showList, ref int listEntry, GUIContent buttonContent, GUIContent[] listContent,
                          GUIStyle buttonStyle, GUIStyle boxStyle, GUIStyle listStyle) {
     bool done = false;
     if(position.Contains(Event.current.mousePosition) &&!showList && Event.current.type == EventType.MouseUp && Event.current.button == 0){
                 showList = true;
     }
     else if(!position.Contains(Event.current.mousePosition) && showList && Event.current.type == EventType.MouseUp && Event.current.button == 0)
     {
         done = true;
     }
     GUI.Label(position, buttonContent, buttonStyle);
     if (showList) {
         Rect listRect = new Rect(position.x, 58, 100, listStyle.CalcHeight(listContent[0], 10.0f)*listContent.Length);
         GUI.Box(listRect, "", boxStyle);
         listEntry = GUI.SelectionGrid(listRect, listEntry, listContent, 1, listStyle);
     }
     if (done) {
         showList = false;
     }
     return done;
 }

}

and the second script:

using UnityEngine; using System.Collections;

public class PopupListUsage : MonoBehaviour { private bool showList= false; private int listEntry= 0; private GUIContent[] list; GUIStyle listStyle; private bool picked= false; void Start (){

 // Make some content for the popup list
 list = new GUIContent[6];
 list[0] = new GUIContent("       Import");
 list[1] = new GUIContent("        Open");
 list[2] = new GUIContent(" Open recent");
 list[3] = new GUIContent("     Save");
 list[4] = new GUIContent("      Save as");
 list[5] = new GUIContent("      Exit");
 listStyle.padding.left = listStyle.padding.right = listStyle.padding.top = listStyle.padding.bottom = 8;

}

void OnGUI (){ //Popup script is in Popup/Popup.cs Folder. if(Popup.List ( new Rect(50,32.5f,75,25), showList, listEntry, GUIContent("Filer"), list, listStyle)) print(list[listEntry]); } }

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

1 Reply

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

Answer by Mike 3 · Jul 14, 2010 at 10:48 PM

it should be:

new GUIContent("Filer")

As you're creating the object, it's not a function

Edit:

if(Popup.List ( new Rect(50,32.5f,75,25), ref showList, ref listEntry, new GUIContent("Filer"), list, listStyle))

The second and third parameters need to be marked as ref(erence) so they can be modified inside the function

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 AnaRhisT · Jul 14, 2010 at 10:51 PM 0
Share

Yeah I know, I tried it, but then it gives me 2 errors, I'll edit my post and write them.

avatar image AnaRhisT · Jul 14, 2010 at 11:02 PM 0
Share

YOU ARE $$anonymous$$Y GOD $$anonymous$$I$$anonymous$$$$anonymous$$ Too bad you've no time to chat with me again :( u forgot how to connect to the mIRC? :O

avatar image AnaRhisT · Jul 14, 2010 at 11:03 PM 0
Share

thanks ;) !!!!!

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

No one has followed this question yet.

Related Questions

Error cs0119 expression denotes a 'type' where a 'method group' was expected (Audio) 1 Answer

Variable Type for an Instance of any Script 2 Answers

Redim a variable 3 Answers

Variable of Type Transform 3 Answers

How do I get unity to tell me what type of variable a variable is? 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