Got an error : Expression denotes a `type', where a`variable', `value' or`method 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]);
}
}