Problem with the chest script / chest menu

audi100

New member
Using verion 1.1.4

Hello i want to have a new chest menu for different sizes of chests.
Basically just having less item slots the smaller the chest.
When i assign the created menus in the corresponding field in the editor it looks fine.
On runtime the field gets changed to the last created menu though.

Is there anything I missed maybe?
Thanks for any help.
 

Attachments

  • chest_menu_editor.jpg
    chest_menu_editor.jpg
    203.3 KB · Views: 4
  • chest_menu_ingame.jpg
    chest_menu_ingame.jpg
    195.6 KB · Views: 4
Thank you for pointing out this bug.

It will be fixed in the next update.

You can fix it right now by changing the FindAndBindChest function in the ChestMenu.cs script:
C#:
/// <summary>
/// Find and reference all the chests in the scene.
/// </summary>
protected virtual void FindAndBindChests()
{
    var allChests = FindObjectsOfType<Chest>();
    for (int i = 0; i < allChests.Length; i++) {
        if(allChests[i].ChestMenu != null){ continue; }
        allChests[i].ChestMenu = this;
    }
}
 
Top