Search Unity

Official Game Foundation 0.2.0 Now Available!

Discussion in 'Game Foundation' started by mingz-unity, Dec 12, 2019.

  1. mingz-unity

    mingz-unity

    Unity Technologies

    Joined:
    Oct 12, 2017
    Posts:
    63
    New:
    • A new debug window for visualizing runtime states (under Play Mode)
      • You can find it under the editor menu: Windows > Game Foundation > Tools
    • Introduced three new Detail types to associate your game assets with item definitions:
      • Sprite Assets Detail
      • Prefab Assets Detail
      • Audio Clip Assets Detail
    • You can now define your own Custom Detail (refer to the updated Documents for more details on how to do this)
    • We have added Sample Projects:
      • You can import them under Package Manager (by clicking on 'Import in project' button) if you're on unity version 2019.x.
      • If you're on 2018.3 / 4, we have made a standalone unity package you can download in the attachment of this post (note that you still need to install the Game Foundation package first before importing this package)
    • Menu items now added links to the documentation and the user forums.
    Improvements:
    • We have re-designed the Stat Detail UI to make your workflow more intuitive
    • You can now choose a Reference Definition while creating a new Inventory Item (which also pre-populates the Display Name and ID fields)
    • Currency Detail now contains a Type and Sub-Type to make it more flexible to describe the nature of currency types.
    • Overall API performance optimizations and minor editor UX improvements
    Changes:
    • As we introduced the new asset details (see above), the original Icon Detail is now deprecated (marked as obsolete and will be removed in a future version). Please use Sprite Assets Detail instead.
     

    Attached Files:

  2. gamakor

    gamakor

    Joined:
    Sep 23, 2015
    Posts:
    1
    Thanks for the update! I was looking at the documentation and it wasn't clear to me how to access Sprite asset detail and Prefab Asset detail in code. Can I get an example of how to reference it?
     
  3. richj_unity

    richj_unity

    Unity Technologies

    Joined:
    Sep 23, 2019
    Posts:
    40
    With a GameItemDefinition reference, grab a reference to its SpriteAssetsDetailDefinition, and then get the Sprite by key (Prefab version works the same but returns a GameObject).

    Example:
    Code (CSharp):
    1. var spritesDetail = someGameItemDefinition
    2.     .GetDetailDefinition<SpriteAssetsDetailDefinition>();
    3.  
    4. if (spritesDetail != null)
    5. {
    6.     someImage.sprite = spritesDetail.GetAsset("My Sprite Key");
    7.     // or
    8.     someImage.sprite = spritesDetail["My Sprite Key"];
    9. }
     
    gamakor likes this.