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. Voting for the Unity Awards are OPEN! We’re looking to celebrate creators across games, industry, film, and many more categories. Cast your vote now for all categories
    Dismiss Notice
  3. Dismiss Notice

How to make Item Containers add to Content when starting game.

Discussion in '2D' started by thomasdamri, Aug 7, 2018.

  1. thomasdamri

    thomasdamri

    Joined:
    Jul 24, 2018
    Posts:
    11
    When I start the game, the item containers aren't put into the content folder. Anyone know a fix for this. Thanks. pic 1.png pic 2.png
     
  2. Lyker

    Lyker

    Joined:
    Feb 27, 2013
    Posts:
    60
    Are you calling PopulateInventory somewhere?
     
  3. thomasdamri

    thomasdamri

    Joined:
    Jul 24, 2018
    Posts:
    11
    Yep I have this. pic 3.png
     
  4. Lyker

    Lyker

    Joined:
    Feb 27, 2013
    Posts:
    60
    And I'm also assuming that _inventoryList is populated as well as Shop being active somewhere in the scene?
     
  5. thomasdamri

    thomasdamri

    Joined:
    Jul 24, 2018
    Posts:
    11
    Yep everything from InventoryList loads correctly but not in the content section, where i want it to load.
     
  6. Lyker

    Lyker

    Joined:
    Feb 27, 2013
    Posts:
    60
    I see you are searching for "content", while the object is named "Content" (with a capital). I'm not sure if Find() is case sensitive. Also, your StoreUIController is already attached to the Content GameObject. For _scrollViewContent you could simply use "this.transform" or "transform". Lastly, you first screenshot shows a "Missing (GameObject)" for the ItemTemplate.
     
    thomasdamri likes this.
  7. thomasdamri

    thomasdamri

    Joined:
    Jul 24, 2018
    Posts:
    11
    Thank you! That fixed it. Cannot believe i didnt spot that.