Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice
  2. Welcome to the Unity Forums! Please take the time to read our Code of Conduct here to familiarize yourself with the rules and how to post constructively.

Unity Game Foundation 0.8.0 is Released!

Discussion in 'Game Foundation' started by UnityManuJack, Nov 30, 2020.

  1. UnityManuJack

    UnityManuJack

    Unity Technologies

    Joined:
    May 30, 2019
    Posts:
    3
    What's New:
    Inventory System
    • GameFoundationSdk.inventory now allows StackableInventoryItems to be created with quantity using CreateItem(StackableInventoryItemDefinition, quantity).

    • Inventory now implements a new event itemMutablePropertyChanged which is fired any time an item's mutable property is changed in the entire GameFoundationSdk.inventory (specific item and property affected are passed as an argument). This is in addition to individual Inventory Items mutablePropertyChanged event which targets only mutable property changes to a specific InventoryItem.
    • GameFoundationSdk.inventory now emits OnCollectionAddedCallback or OnCollectionDeletedCallback events when IItemCollections are created or deleted (respectively), as well as OnCollectionItemAddedCallback or OnCollectionItemRemovedCallback events whenever items are added to or removed from IItemCollections.
    • InventoryItemDefinitionAsset.initialQuantityPerStack has been added to the list of overridable catalog data for IExternalValueProvider.

    Improvements
    UX Improvements
    • Added a Generate Constants button to CatalogAssets in Unity Inspector window to permit exporting constants. To utilize this feature, select a Catalog (i.e. SampleCatalog) and click the Generate Constants button at the top. Specify an export filename (must be inside Assets folder and is of type cs) and GameFoundation will generate all constants to simplify catalog access and avoid typos.



    • Rewards now appear in the Game Foundation Debugger.


    • Editor now clamps the initial balance between 0 and maximum balance.

    • Renamed Real Number name on Properties to Double.

    • Changed "<none>" option in filter dropdown to “<No Tags>”

    • Renamed editor window tab names to align better on Game Foundation naming conventions.
    API Improvement
    • Improved Game Foundation initialization flow to throw exceptions as less as possible.

    • Improved Game Foundation Initialization to have better IAP SDK and Purchasing Adapter integration and exception handling during the Initialization.

    • Game Foundation initialization will no longer fail if an IAP Transaction's product id is missing for the platform being built to.

    • The purchase of that IAP Transaction can be attempted but will fail because a product id is required, however it will no longer prevent all of Game Foundation from functioning.

    • Some fields from the different implementations of CatalogItemAsset are now wrapped in a ExternalizableValue<T>. They can be used as regular `T` properties. These fields are externalizable through `IExternalValueProvider` if you want to override them with an external source.

    • Added new types of exception to be as explicit as possible when they occur. Avoid throwing Exceptions as much as possible and use more fitted exception types instead.
    Sample Scenes
    • All sample scenes now have their own catalog. The user won’t need to download the first sample scene that has the catalog to be able to use sample scenes.

    • Adjusts the canvas match setting from width to height for Promotion and Reward Sample Scenes so that they fit in both screen orientations.

    Changes
    • Changed GameFoundationSdk.dataLayer property to public from internal.

    • * Deferred and Deferred<T> are now IDisposable so you can use them in an using block to release them automatically.

    • Game Foundation Init Prefab's default Data Layer has changed to Local Data Persistence from Memory Layer.

    • Renamed Reward Popup prefab to Progressive Reward Popup.

    • All sample scenes using Memory Data Layer or Persistence Data Layer now use Game Foundation Init Prefab instead of code initialization.

    • PurchaseButton and RewardClaimButton prefabs now have a weak reference to the Purchase and Claim methods. They can be found in the button's onClick listener list in the inspector, and can be removed.

    Removed

    • IDictionaryConvertible has been removed since the JsonDetail no longer exists.

    Fixes

    • Fixed compilation errors when using IAP package version 2.1.0 or 2.1.1.

    • Fixed issue "InvalidOperationException: UnityPurchasingAdapter Error: GameFoundationSdk.Initialize() must be called before FindProduct is used". There are two possible causes:

    • Fixed an issue where the reward countdown would start going backwards if you missed an item and Reset if Expired is set to false.

    • Fixed an issue where a reward with multiple items, Reset if Expired set to true, and a countdown of 0 would be reset immediately after the first claim.

    • Fixed an issue where a missed reward item would show as Locked if it was right before the latest claimed item and during cooldown.

    • Fixed an issue where sample scenes has the wrong aspect ratio in portrait mode.

    • Fixed an issue where Resources Asset Property selector shows duplicates for prefabs that are stored in Resources folders.

    • Fixed an issue where Chilliconnect breaks linkage to IAP product keys that have lower case letters in them, by converting them to uppercase.

    • Fixed an issue where Debug window doesn’t show changes made to mutable properties during runtime until you have moused over or clicked on the property in the debug window.

    • Fixed an issue where the Null reference to the parent Reward of a Reward Item when the Reward and RewardItem are newly created.

    • GameFoundationInit component now serializes changes to the Override Catalog Asset bool and asset values, and the catalog asset value is no longer forgotten when unchecked.

    • Fixed errors when editing asset property in the Debug Window.
     
    mk0a1a, richj_unity and erika_d like this.
  2. moonpower1

    moonpower1

    Joined:
    Dec 7, 2017
    Posts:
    5
    when i want to add sprites , it is asking me for an object !!!
     
  3. U_AdrienPDB

    U_AdrienPDB

    Unity Technologies

    Joined:
    Aug 14, 2019
    Posts:
    7
    Hi, from what I understand you are trying to add a Sprite to a "Resources Asset" property of a Catalog Item, right ?
    If so make sure the sprite you want to add is inside a "Resources" folder and it isn't part of a sprite atlas, these aren't supported because the Resources API doesn't support them.

    If you still need help with your issue, please give us more context so we can clearly understand your situation.
     
    erika_d likes this.
  4. RaadAldalaq

    RaadAldalaq

    Joined:
    Sep 29, 2016
    Posts:
    4
    It seems like the package has gotten no updates since this post, is there a timeline/road map to see what upcoming/when an official release will make it?
     
    P_Jong likes this.
  5. hackily

    hackily

    Joined:
    Aug 24, 2020
    Posts:
    1
    Is there a way to make a single/non-progressive reward claimable just once? Having a reward cooldown of 0 allows it to be claimed an infinite number of times.

    My current workaround is to store the claimed status in my own hashset, but it would be great if Game Foundation took care of this aspect.
     
  6. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hi @RaadAldalaq,

    Thanks for your question! Unfortunately, we don't have a roadmap we can share at this moment as we're currently in a planning phase for Game Foundation's new features. Once we have completed our planning we'll be sure to share what's coming next!

    Hi @hackily,

    Thanks for your feedback on the reward system, we will keep it in mind! For now, you are correct that the only way to stop a reward (of any length) from looping back to the start of the reward is by tracking it yourself and then stopping showing it once it's been claimed. Since you're doing just a single step/non-progressive reward, an alternate work around could be to set up a transaction as free and disguise it as a reward in your UI?
     
    Last edited: Mar 9, 2021
  7. binhnguyen991

    binhnguyen991

    Joined:
    Feb 14, 2014
    Posts:
    5
    It seem there is an mistake in RewardManageImpl.cs file at GetData method. It make load reward data error

    Code (CSharp):
    1.  
    2. ///  void GetData() method
    3. foreach (var eachRewardData in data.rewards)
    4. {
    5.     if (rewardData.key.Equals(rewardDefinition.key))
    6.     {
    7.         rewardData = eachRewardData;
    8.     }
    9.  }
    10.  
    Correct code should be

    Code (CSharp):
    1.  
    2. ///  void GetData() method
    3. foreach (var eachRewardData in data.rewards)
    4. {
    5.     if (rewardData.key.Equals(eachRewardData.key))
    6.     {
    7.         rewardData = eachRewardData;
    8.     }
    9.  }
    10.  
     
  8. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hi @binhnguyen991,

    Good eye and thanks for pointing it out! This section of code has actually already been refactored and just to be sure I've double checked and this bug was fixed during the refactor. :) Thanks again!
     
  9. Harsh-099

    Harsh-099

    Joined:
    May 1, 2020
    Posts:
    264
    Hello, I just installed Game Foundation yesterday and found it great. As far as I know, there is a CatalogAsset, which is to be Assigned in the Catalog settings. GF will use this to read/write data from/to the various GF windows. There is a default catalog included with the package, with has a main shop by default.
    But I decided to have a catalog with a custom name. So I went to Assets>Game Foundation>Catalog. It created one with the default name and if I did not create in the root Assets folder, it takes me one level up in the Project Window. It is strange I think.
    Then when I tried to rename it, pressed F2 and typed in, such as MyCatalog, it moved the Main asset inside the the list which is shown by clicking the expandable Arrow, and moves the CatalogTag asset outside and renames it. In the console, and warning is logged stating that the data of the script is corrupted.
     
    erika_d likes this.
  10. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hi @Harsh-099,

    For the renaming the catalog issue, it sounds like you're running into the same issue described in this thread? If that's the case, unfortunately it is a known issue with Unity Editor, though it looks like it is fixed in 2021 (I tested in 2021.1.2f1). Other than upgrading to 2021, we don't have any suggested workarounds at this time, so I would suggest not renaming the database on earlier unity versions. If this is a problem and you absolutely need the database renamed, can you tell us more about your use case for needing a different name?

    For the other issue of it moving you to a folder one level up, I was able to duplicate it, and it's very strange. It's not fixed in 2021 so I will have to look into this one more and see if it's a bug in our creation code. Thanks for the report!
     
  11. Harsh-099

    Harsh-099

    Joined:
    May 1, 2020
    Posts:
    264
    No that is not a very necessary thing. I can stick with the default name.

    Welcome, I wish that this issue will be fixed too.

    Thanks.
     
    erika_d likes this.
  12. dannyalgorithmic

    dannyalgorithmic

    Joined:
    Jul 22, 2018
    Posts:
    86
    Are you planning on incorperating Addressables in Game Foundation in the next update?
    The two together would be a insanely powerful combo, easing our development cycle by a LOT.
     
    erika_d likes this.
  13. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hi @Harsh-099,

    For the navigating one level up on catalog asset creation issue, I've looked into it further and it's coming from us calling EditorUtility.FocusProjectWindow() after creation. I'm still unsure whether the root issue is an editor bug, or whether we're misusing it, but I have a potential fix that resolves the issue, so we should be able to get that fixed in future releases. :)

    Hi @dannyalgorithmic,

    Yes, we plan to include Addressables as an alternative option to Resources Assets in the Static Properties of the various Game Foundation objects. If there are additional ways you would like to see Addressables incorporated into Game Foundation in the future, do please let us know though!
     
    spryx and dannyalgorithmic like this.
  14. dannyalgorithmic

    dannyalgorithmic

    Joined:
    Jul 22, 2018
    Posts:
    86
    I'd appreciate the ability to use AssetReferences like in the rest of the editor to select an addressable, particularly because the I'd know for sure that it is a valid addressable, but be able to have that automatically translate to the string address for serialization since we seem to not be able to serialize AssetReference.


    To clarify, it'd be an Addressable Reference in editor, but serialize as a string of the address if that makes sense
    AddressReferenceT<SomeScriptable> assetRef => "actualAddressAtRuntime"

    Perhaps I am off the mark, but that seems like it'd help a lot.
    Thanks for responding!
     
    erika_d likes this.
  15. dannyalgorithmic

    dannyalgorithmic

    Joined:
    Jul 22, 2018
    Posts:
    86
    Even better, might just be the ability to (optionally) completely sync Addressables (built) data to Game-Foundation
     
    Last edited: Apr 16, 2021
    erika_d and Harsh-099 like this.
  16. Harsh-099

    Harsh-099

    Joined:
    May 1, 2020
    Posts:
    264
    That will be truly a great improvement
     
    dannyalgorithmic likes this.
  17. Harsh-099

    Harsh-099

    Joined:
    May 1, 2020
    Posts:
    264
    Hey @erika_d, I was trying the Game Parameter window. I created a key and a static property to know at runtime that which sword the player has. It is #1 sword if (sword == 0, where sword is the static property of playerSword Game Parameter) It is #2 sword if (sword ==1) and #3 sword if (sword==2)

    Now, initially it is 0, means #1 sword. The progress in game will replace the player's sword with a high power sword. So, the sword property will be set to 1 to let the sword system give player #2 sword and 2 similarly, as the gameplay progresses.

    Now I am able to read this property and set the player's sword accordingly. But the problem is Game Parameter has only static properties. Which I can't change at runtime (this is what I need to do).

    My suggestion is Game Parameters should also contain Mutable Properties. So we can really change the parameters to reflect and let other in-game systems know the progress of game.

    Thanks
     
    erika_d likes this.
  18. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    Hey @Harsh-099

    Ok thanks for that request for having Mutable Properties on Game Parameters. The reason they don't have mutable properties right now is because mutable properties only exist on the runtime instance of the object, vs the definition (for instance to get mutable properties for an Inventory Item, you need to be looking at the InventoryItem, not the InventoryItemDefinition). And Game Parameters don't have a runtime instance.

    I'd like to learn more about why you're using Game Parameters for this though, instead of using Inventory Items? From what you've said, it seems like you could either have a Sword Inventory Item, with a mutable property that designates the power level of the sword. Or could have several sword Inventory Items (Basic, Greater, Super Powerful, etc), and then replace which sword is in the player's inventory as needed based on level. But maybe there's something additional going on that makes Inventory Items not a good fit for you?
     
  19. Harsh-099

    Harsh-099

    Joined:
    May 1, 2020
    Posts:
    264
    Yes, I have this setup. But where should the data (that tells the index, or which sword is currently active) be saved so that it persists through the time when game is turned off, or not played.

    Do I have to store in some custom solution, (I already have one). But I thought that Game Parameter would be nice to store this parameter. As in my case the lower power sword will never replace the higher power sword. So as the game progresses, I have to change the parameter to initially 0, then 1 and finally 2, which will be always 2 until clearing the save data.

    Until Game Parameter will have Mutable properties, I will wait and use some custom solution.

    Another thing that I notices yesterday, if there are script compilation errors in project, I cannot change between the different inventory items, and the other different items and other windows.
    Thanks
     
    erika_d likes this.
  20. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    8,353
    I'd like to chime in on this. I also would like to see Game Parameters as mutable too. It can be used as blackboard for gameplay like "questXnextStep:2", but "questZdone:true", "princessPeachAffinity:-1", etc. So game parameters what change over time.

    And while I am at it, here is another wish:
    - when I query a store for available transactions I would like to give modifiers like "right now everything is 10% on sale" or "right now everything is +10". This should not modify the stored transactions, it's only for the store and for the moment.
    -- use case: using the store like in-game vendor and changing prices (according to game play rules) is extremely common

    Question: can I somehow synchronize parts of the database? I'm working on a (max) 4 player co-op RPG and I was planning to utilize GF for this. This would be a p2p MP, one player's computer is the server, it stores "the truth", every other player's GF should be synched with this source of truth somehow. (obviously only the mutable parts need to be synched)
     
    erika_d likes this.
  21. erika_d

    erika_d

    Unity Technologies

    Joined:
    Jan 20, 2016
    Posts:
    400
    What I envision here is you have all the different swords defined as InventoryItemDefinitions (which is what you're creating when you add them in the Inventory Item window in the editor) and then in the beginning of the game (or whenever is appropriate) you create an Inventory Item (which is an instance of the definition) of the first sword. That instance can then be saved by using the local persistence layer when you initialize Game Foundation. Then when the player reaches the level where you want to trade up to the next sword level, you would delete the basic sword Inventory Item and create an Inventory Item instance of the next level sword definition. Check out the InventoryBasics and Data Persistence sample scripts (downloadable from package manager) for examples of how to create and remove inventory items and how to save state with the local persistence data layer. If you're already familiar with that functionality, and it doesn't do what you want, then maybe you can give more details about your setup.

    I'm not able to duplicate the issue with script compilation/changing inventory items (you mean like in the game foundation window, right?) Can you give more details/reproduction steps if you're still experiencing it?

    @Lurking-Ninja

    Thanks for your +1 on the mutable game parameters, and the idea of a more flexible transaction group modification system. As a workaround for a strategy like that I would say you could create a couple different stores with transactions with different price/amounts, and then choose which store you want to load, but I'm guessing your desire is for more flexibility so that it doesn't have to be pre-set up like that? I've made a note for those feature requests. :)

    As far as synchronizing part of the database, or having a single computer be the source of truth, we don't yet have anything built in for that. You could conceivably right your own data layer to support that (like how we wrote the chilliconnect one that can be found in the ChilliConnect sample scene) or use a separate system to sync the whole database file, but that's the best I can think of at the moment. I'll note it as an additional feature request though.
     
  22. Lurking-Ninja

    Lurking-Ninja

    Joined:
    Jan 20, 2015
    Posts:
    8,353
    Yes, you know, let's say you have 200 items in the game (it seems a lot, but believe me, it's not as soon as we leave behind the f2p mobile space), we need to maintain those 200 items. We need to balance them and everything. Manually. Now, let's say we only have one currency, then we need to maintain 200 transactions. If we need to duplicate these for every occasion, we will reach the 1000-s very quickly. It's a maintaining nightmare.

    I am pressuring the temporary transaction-modification, because it makes our life simpler. I can put modifiers on the items and let the temporarily modified transactions happen.
    Like
    - I have a long sword. It is iron, the price modifier is 1, the price in the transaction table is 10 gold.
    - I have a long sword, It is silver (or whatever), the price modifier is 2, the price in the transaction table is the same long sword, but I can modify the transaction for this one so I multiply the price with the price modifier.
    - I have a mithrill long sword, so I have a price modifier 10... you got the idea. This way I don't need to maintain all the transactions for all the sub-type of items, I can tweak the modifiers relative to each other. Better game economy.

    Yeah, I know, I'm planning to do that "fake IAP"-connector. Will see how it goes.
    But it still would be great having only the delta. You know, what changed since a transaction, so we don't send everything through the wire and I don't have to keep tabs what transactions were already synced outside of GF.

    Thank you for listening to our ideas!
     
    Last edited: Apr 23, 2021
    erika_d likes this.
unityunity