Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Using custom editor windows to create items for use in-game

Discussion in 'UI Toolkit' started by Syntaxflow, May 20, 2021.

  1. Syntaxflow

    Syntaxflow

    Joined:
    Apr 17, 2015
    Posts:
    18
    I have built a custom editor window where I can display a list of items. From the list I can add a new item or select an existing item. When an item is selected, I can edit or remove it. I am using UXML for the window with a ListView for the item list and Box/ScrollView for the selected item.

    I am using the Asset Database to add, update and remove items based on this tutorial:


    In that tutorial, the developer is creating cards that seem usable in game. However, I am at a loss of how to load the assets in runtime. It seems that the asset database is only used for the editor, not in game? If so, why even bother creating cards as in the tutorial if they can't be used in game?

    I am clearly missing a piece of the puzzle and my google search results have me pulling my hair out. Any assistance would be greatly appreciated.

    NOTE: Using Resource.Load on any of the created item assets residing in "Assets/Resources" results in a null value.
     
  2. martinpa_unity

    martinpa_unity

    Unity Technologies

    Joined:
    Oct 18, 2017
    Posts:
    471
    Hey, Resources.Load(...) should be the way to go. Note that it is expecting a different path than the AssetDatabase methods (i.e. paths for Resources.Loat() are relative to the Resources folder and must not contain the extension).