x


Unresolved members & AutoComplete issue

When I hover over the itemName of this code: "inventory[i].itemName", it says "Unresolved member 'itemName'" in the tooltip.

The biggest issue is that when I press period after [i], AutoComplete/IntelliSense still shows the old variables I originally made my InventoryItem class with (before itemName was there). It won't update to show itemName/itemObject/itemTex.

But the full code does compile and work.

public InventoryItem[] inventory;

[System.Serializable]
public class InventoryItem
{
    public string itemName;
    public GameObject itemObject;
    public Texture2D itemTex;
}

public void AddItem(InventoryItem item)
{
    for(int i = 0; i < inventory.Length; i++) 
    {
       if (inventory[i].itemName == null && inventory[i].itemObject == null && inventory[i].itemTex == null)
       {
            inventory[i] = item;
         print("ADDED - " + inventory[i].itemName + " - to slot " + i);
         return;
       }
    }   
    print("Inventory full and i = " + inventory.Length);
}
more ▼

asked May 27 '11 at 05:24 PM

Stardog gravatar image

Stardog
224 21 29 36

Quit & restart? Might work, sounds like a cache issue.

May 27 '11 at 06:17 PM TowerOfBricks

Restarting doesn't work. I'll try restarting my entire computer.

May 27 '11 at 06:50 PM Stardog

Restarting didn't help. I deleted "Application DataMonoDevelop-UnityCodeCompletionData" and it generated some new ones when pressing period inside Mono, but it still generated the wrong variables. Those variables don't even exist anywhere in any script.

May 27 '11 at 08:00 PM Stardog

Solution - Use Visual Studio. The sln can be opened directly, and the IntelliSense detects everything. Seems to be some bug with with Monodevelop.

May 28 '11 at 01:19 PM Stardog
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1363
x21

asked: May 27 '11 at 05:24 PM

Seen: 603 times

Last Updated: May 28 '11 at 01:19 PM