Hey guy’s, I’m still working on that Inventory stuff! My issue today, is with GUI.Button. Iv scavenged around online, and have tried to CopyPasta example code, and even that doesn’t work!
So, What I’m trying to do is when the game pauses, I have a series of buttons that pop up. Those button’s are created by reading the player’s inventory value, and returning buttons. The problem is, the GUI.Button command always returns errors. (error CS0119: Expression denotes a type', where a
variable’, value' or
method group’ was expected.)
Here’s some code clips, to help bring the problem to light…
public class PauseMenuScript : MonoBehaviour
{
public GUISkin skin;
private float startTime = 0.1f;
public Texture2D heal1Texture;
private float savedTimeScale;
public GameObject start;
public enum Page { Playing, Inventory}
private Page currentPage;
.........
void OnGUI () {
if (skin != null)
{
GUI.skin = skin;
//GUI.Label(rect(0,0,100, 50), texture1);
}
if (IsGamePaused())
{
GUI.color = new Color(0,0,0);
switch (currentPage)
{
case Page.Inventory:
InventoryMenu();
InventoryScreen();
ShowBackButton();
break;
}
}
}
void InventoryMenu()
{
BeginPage(400,200);
if (GUILayout.Button (IsBeginning() ? "Play" : "Continue"))
{
UnPauseGame();
}
EndPage();
}
void InventoryScreen()
{
for (int i = 0; i < GetComponent<ThePlayerInventory>().heal1items; i++)
{
GUI.Button(Rect(400,400,450,450), heal1items);
}
}
Everything works fine until it’s time to create a button. This did not work, even before I threw in the For Statement, I was just trying to find another work around before I asked.
Any help is appreciated guys!
Thanks!