baking-bad / tezos-unity-game

Complete shooter sample game demonstrating the Tezos SDK For Unity
MIT License
7 stars 2 forks source link

Bug Reports and Documentation Expansion Requests #14

Open oskar-ziller opened 6 months ago

oskar-ziller commented 6 months ago

Bug Reports:

Bug 1: App Crashes After Wallet Connection and Message Signing

Description: The app crashes consistently upon connecting a wallet and signing the message. This issue appears to be related to the retrieval and deserialization of tokens for a contract. On the first app launch and login, the crash occurs right after signing in. On subsequent launches, the crash happens as soon as the game loads, likely because it attempts to fetch contract details while already connected.

TezosAuthenticator.OnEnable

WebGL2.framework.js:2783 You are using Mainnet. Make sure you are not using Mainnet for testing purposes.
WebGL2.framework.js:2783 Pinata API key is not set in TezosConfigSO. You will not be able to upload images to IPFS.

Tezos SDK initializing...

(index):119 Unity instance initialized.
WebGL2.framework.js:2788 TezosAuthenticator.Start: Wallet is not connected

WebGL2.framework.js:2788 ToggleUIElements: isAuthenticated: False

WebGL2.framework.js:2788 Tezos SDK initialized

webgl-frontend.js:2 UnityReadyEvent
webgl-frontend.js:2 beaconActiveAccount {accountIdentifier: '2RvYXmkQRBydcqpAzwuY', senderId: '2sV2dZ8ivs3s2', origin: {…}, walletKey: 'temple_chrome', address: 'tz1SvPrcHnBYHuickqLBMuZeBmjUwTcikaRb', …}
webgl-frontend.js:2 InitWalletProvider
webgl-frontend.js:2 networkName mainnet
webgl-frontend.js:2 rpcUrl https://mainnet.tezos.marigold.dev
webgl-frontend.js:2 walletType beacon
webgl-frontend.js:2 appName Tezos Shooter
webgl-frontend.js:2 appUrl https://tezos.com
webgl-frontend.js:2 iconUrl https://tezos.com/favicon.ico
webgl-frontend.js:2 BeaconWallet constructor Tezos Shooter https://tezos.com https://tezos.com/favicon.ico
webgl-frontend.js:2 BaseWallet constructor Tezos Shooter https://tezos.com https://tezos.com/favicon.ico
WebGL2.framework.js:2788 Tezos: OnWalletConnected

WebGL2.framework.js:2788 Sending GET request to https://api.mainnet.tzkt.io/v1/tokens/balances?account=tz1SvPrcHnBYHuickqLBMuZeBmjUwTcikaRb&balance.ne=0&select=account.address%20as%20owner,balance,token.contract%20as%20token_contract,token.tokenId%20as%20token_id,token.metadata%20as%20token_metadata,lastTime%20as%20last_time,id&sort.asc=id&offset.cr=0&limit=10000

Getting tokens for contract: KT1TSZfPJ5uZW1GjcnXmvt1npAQ2nh5S1FAj

WebGL2.framework.js:2788 Sending GET request to https://api.mainnet.tzkt.io/v1/tokens?contract=KT1TSZfPJ5uZW1GjcnXmvt1npAQ2nh5S1FAj&select=contract,tokenId%20as%20token_id,metadata%20as%20token_metadata,holdersCount%20as%20holders_count,id,lastTime%20as%20last_time&sort.asc=id&offset.cr=0&limit=10000

TezosAuthenticator.OnWalletConnected

WebGL2.framework.js:2788 ToggleUIElements: isAuthenticated: True

Invoking error handler due to
RuntimeError: null function or function signature mismatch
at ReflectionJsonTypeInfo_1__ctor_mBBD5C7124B28E868C2B7418B277F7F18CA7EB0AF_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[113268]:0x1adcb16)
    at JsonConverter_1_CreateReflectionJsonTypeInfo_m4482B7F48656C3B83F0062F577952D4D7C2DDA9D_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[106273]:0x17a5db9)
    at DefaultJsonTypeInfoResolver_CreateJsonTypeInfo_m05D1142140C1430B25C0BAD71C6D9F8DBD5E48E2 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24799]:0x687347)
    at DefaultJsonTypeInfoResolver_GetTypeInfo_m868495EFF7F9C4260044B802A7890540BF2B299D (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24797]:0x686e05)
    at JsonSerializerOptions_GetTypeInfoNoCaching_m058BE60C71EF3C9D93FABA0EADE140393885E83E (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[108741]:0x185e8b0)
    at ConcurrentDictionary_2_GetOrAdd_mF8E3897F8089492DC23AF0FE945A15B5C2499B00_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[105471]:0x176828f)
    at CachingContext_GetOrAddJsonTypeInfo_mBFB30910DBDB948FF892B97470AEF67EB7DD0DFA (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[105680]:0x177c8c8)
    at JsonSerializerOptions_GetTypeInfoInternal_m7DAD09FFF056759B3652D9342889ED37B053C4BD (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[108712]:0x185ad0d)
    at JsonPropertyInfo_Configure_mC9A67115E9748B7E9679E7D1048BB14C6CC14C1F (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24935]:0x689b3f)
    at dynCall_vii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[198990]:0x2e8c871)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_vii (http://127.0.0.1:8080/Build/WebGL2.framework.js:17881:5)
    at JsonTypeInfo_InitializePropertyCache_mB2B6883772CE3C54ECF815D81A3FD77097519A30 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[25050]:0x68de63)
    at JsonTypeInfo_Configure_m88740E97091F790C15ABE949A73C65AA06077DF6 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[25048]:0x68d46d)
    at dynCall_vii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[198990]:0x2e8c871)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_vii (http://127.0.0.1:8080/Build/WebGL2.framework.js:17881:5)
    at JsonTypeInfo_U3CEnsureConfiguredU3Eg__ConfigureLockedU7C143_0_m16239A6713A0A8F691A39E5E8B2EDDC24CDB9C4F (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24967]:0x68b26c)
    at JsonTypeInfo_EnsureConfigured_m0487DB6FF03D230815B5C0900957F3D9DE2BE337 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24971]:0x68b5e9)
    at JsonSerializerOptions_GetTypeInfoInternal_m7DAD09FFF056759B3652D9342889ED37B053C4BD (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[108712]:0x185ad21)
    at JsonTypeInfo_get_ElementTypeInfo_mFA54A760A6AE6D07670634B0F903A2907E23BC05 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[25034]:0x68d060)
    at JsonCollectionConverter_2_OnTryRead_m4F395885A90A546A6F5302CDA125A02AB1785186_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[25891]:0x6a1d12)
    at JsonConverter_1_TryRead_m2D02DCC42B29C5B1E6EC54895EE622486CDE32A0_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24060]:0x661e7d)
    at dynCall_iiiiiiii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[199004]:0x2e8c939)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_iiiiiiii (http://127.0.0.1:8080/Build/WebGL2.framework.js:18002:12)
    at JsonConverter_1_ReadCore_m6FB3922BDC1568E93F770E7335A2547AC74C9590_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24059]:0x661041)
    at JsonSerializer_ReadFromSpan_TisRuntimeObject_mFA5327E6D3BC34FE51A681F03C3CAC8B39DD01B9_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[102162]:0x16f0144)
    at dynCall_iiiii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[198997]:0x2e8c8c7)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_iiiii (http://127.0.0.1:8080/Build/WebGL2.framework.js:17936:12)
    at JsonSerializer_ReadNode_TisRuntimeObject_m72F69602C6E1A679C175EBBE7292F99E551F8310_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[102146]:0x16edfb9)
    at JsonSerializer_Deserialize_TisRuntimeObject_m38C3C9B954E21CA29C0FC6391EB2F9B718AEDC14_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[102145]:0x16edaa3)
    at NftConverter_Read_mE9042ED0E597366255A53A8CA1C2C8674D1E7177 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[79218]:0x117b00c)
    at JsonConverter_1_TryRead_m2D02DCC42B29C5B1E6EC54895EE622486CDE32A0_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24060]:0x661d69)
    at dynCall_iiiiiiii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[199004]:0x2e8c939)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_iiiiiiii (http://127.0.0.1:8080/Build/WebGL2.framework.js:18002:12)
    at JsonConverter_1_ReadCore_m6FB3922BDC1568E93F770E7335A2547AC74C9590_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[24059]:0x661041)
    at JsonSerializer_ReadFromSpan_TisRuntimeObject_mFA5327E6D3BC34FE51A681F03C3CAC8B39DD01B9_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[102162]:0x16f0144)
    at JsonSerializer_ReadUsingMetadata_TisRuntimeObject_mC2CED0997874109627825C323713E9AE582BEF74_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[102144]:0x16eda04)
    at JsonSerializer_Deserialize_TisRuntimeObject_mC1531C6302AD30AD675F5A44902B866E2A483288_gshared (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[102143]:0x16ed92d)
    at .LJsonSerializer_Deserialize_TisRuntimeObject_mC1531C6302AD30AD675F5A44902B866E2A483288_gshared_bitcast.10 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[79170]:0x117839b)
    at dynCall_iiii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[198991]:0x2e8c87f)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_iiii (http://127.0.0.1:8080/Build/WebGL2.framework.js:17914:12)
    at UserDataManager_U3CLoadGameNftsU3Eb__30_0_m9731221B694A60E42DF3B93D97705FFB17698316 (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[79169]:0x1177dce)
    at dynCall_viii (http://127.0.0.1:8080/Build/WebGL2.wasm:wasm-function[198994]:0x2e8c89f)
    at http://127.0.0.1:8080/Build/WebGL2.framework.js:1815:22
    at invoke_viii (http://127.0.0.1:8080/Build/WebGL2.framework.js:17958:5)

Bug 2: QR Code Unreadable in Standalone Builds Due to Graphics Settings

Description: The QR code is unreadable in standalone builds, likely due to the graphics quality settings which default to low.

Bug 3: iOS/MacOS Builds Fail

Description: MacOS builds are currently failing. The issue seems related to JavaScript functions that are not properly encapsulated with #if UNITY_WEBGL preprocessor directives. There should be empty stub functions for non-WebGL platforms. I couldn;t test on Android platforms.

Request for Expanded Documentation

Could you provide more detailed documentation on the following topics:

  1. Payload Signing During Login: A detailed explanation of how payload signing is handled during the user login process.
  2. Backend Setup and Integration in Unity: Elaborate on how the backend is set up and interacts with Unity, especially concerning HTTP requests. Please provide more details on how a typical request like /game/boss/kill/ is processed behind the scenes.
  3. NFT Drops: An explanation on how NFT drops are managed within the game. This should include how NFTs are created, how they are distributed to user wallets, and how the GameParameters structure is incorporated into the NFTs.
k-karuna commented 6 months ago

Hi @oskar-ziller! As for App Crashes After Wallet Connection and Message Signing: this is strange behaviour but if you try to build app in targeted Unity version 2022.3.5f1 this problem will not be reproduced. As for standalone builds, we decided do not support any platform except of WebGL therefore QRCode on WebGL side generated with JavaScript without issues. Expanded docs for signing, backend api and for NFT manging explanation are added.