Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Separate Instances of Lists

Discussion in 'Scripting' started by naphid, May 24, 2015.

  1. naphid

    naphid

    Joined:
    May 24, 2015
    Posts:
    2
    So, I made an inventory system and I also wanted to have chests too. The items in the chests are defined in a public list of type Item(a type I defined). The problem is that I need each chest to have separate inventories. I think that setting the lists to private would allow this, however I want to be able to modify the chest's inventories in the inspector. How could I go about doing this?
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Just make them public. Every script is an instance anyway.

    --Eric
     
  3. naphid

    naphid

    Joined:
    May 24, 2015
    Posts:
    2
    Thanks a lot! That's what I thought too, so I wasn't sure why it wasn't working. It turns out I forgot to set the texture of the item in the inspector so it turned out blank.