Can someone please help me? When I make itemIconSize equal a new vector 3 I get tons of errors.
Assets/Inventory/InventoryGUI.cs(8,32): error CS0119: Expression denotes a `type', where a `variable', `value' or `method group' was expected
using UnityEngine;
using System.Collections;
public class InventoryGUI : MonoBehaviour {
Texture2D backDrop;
Vector3 windowPosition = new Vector3(900, 150, 0);
Vector3 windowSize = new Vector3(500.0f, 500.0f, 0.0f);
Vector3 itemIconSize = Vector3(64.0f, 64.0f, 0.0f);
float updateListDelay = 1.0f;
float lastUpdate = 0.0f;
Transform[] UpdatedList;
Inventory associatedInventory;
void UpdateInventoryList (){
UpdatedList = associatedInventory._contents;
}
void OnGUI (){
Vector3 currentX = windowPosition.x;
Vector3 currentY = windowPosition.y;
GUI.DrawTexture( new Rect(windowPosition.x,windowPosition.y,windowSize.x,windowSize.y),backDrop,ScaleMode.StretchToFill);
foreach(Transform i in UpdatedList){
Item item = i.GetComponent- ();
if(GUI.Button( new Rect(currentX, currentY, itemIconSize.x, itemIconSize.y), item.inventoryIcon)){
associatedInventory.RemoveItem(i);
lastUpdate = 0.0f;
}
currentX += itemIconSize.x;
if(currentX + itemIconSize.x > windowPosition.x +windowSize.x){
currentX = windowPosition.x;
currentY += itemIconSize.y;
if(currentY + itemIconSize.y > windowPosition.y + windowSize.y){
return;
}
}
}
}
void Update (){
if(Time.time > lastUpdate){
lastUpdate = Time.time + updateListDelay;
UpdateInventoryList();
}
}
}
↧