How to create an in-game currency on-chain - Unity ERC-20 token

Sdílet
Vložit
  • čas přidán 4. 07. 2024
  • In this video, we'll go over how to create a simple Unity web3 game where you collect gems and can claim those gems as ERC20 tokens in game. We will be developing with thirdweb's Unity SDK and going over tools to connect a wallet, check token balances, and even claim ERC20 tokens all within your Unity game.
    *Mumbai testnet support has been officially deprecated. Transition to the Amoy testnet for improved scalability and reduced gas fees.*
    TokenDrop (ERC20) contract: thirdweb.com/thirdweb.eth/Dro...
    Unity SDK: github.com/thirdweb-dev/unity...
    Player controller script: github.com/Brackeys/2D-Charac...
    Game assets (Sunny Land): assetstore.unity.com/packages...
    Openzeppelin Defender: www.openzeppelin.com/defender
    Forwarder Address docs: portal.thirdweb.com/glossary/...
    Join our Community of over 30,000 Web3 builders: / discord
    thirdweb Official Site: thirdweb.com/dashboard
    thirdweb Twitter: / thirdweb
    Timestamps:
    00:00 Introduction
    01:03 Game demo
    02:43 Deploy ERC20 token smart contract
    04:34 Create and setup new Unity game
    06:05 Build game
    26:15 Add a connect wallet feature
    34:30 Token balance
    40:18 Claim tokens
    56:27 Gasless transactions
    01:00:10 Conclusion
  • Věda a technologie

Komentáře • 53

  • @thirdweb_
    @thirdweb_  Před rokem +1

    Thank you for watching! Be sure to leave a comment with what you'd like to see us build next. 👇
    If you haven't already, hit the subscribe button to be notified every time we drop a web3 development tutorial. 💫

    • @chertovdermo3459
      @chertovdermo3459 Před 5 měsíci

      will you guys do a video for using unreal for this instead of unity?

    • @dimmewestfingers9391
      @dimmewestfingers9391 Před 4 měsíci

      What if my smart contract does not have a 'mint function' how do i set the claim button to move tokens to a connected wallet address, thanks

  • @crypt0z
    @crypt0z Před rokem

    Good stuff! It's good to see how ThirdWeb integrates with Unity in action

    • @thirdweb_
      @thirdweb_  Před rokem

      Thank you! Glad you enjoyed the video.

  • @gsdealer7691
    @gsdealer7691 Před rokem

    As always good content...keep going.

  • @puyan6756
    @puyan6756 Před 5 měsíci

    Hi , Great Tutorial But i have some questions !!
    my question is
    When we make the game according to your instruction, can we really use these tokens and will they be added to our wallet or are they only for the game and have no use?
    I really wonder if a game developer can earn money in this way?
    Sorry it took so long

  • @bhok5228
    @bhok5228 Před rokem

    Great tutorial😄

  • @kursadaydn6773
    @kursadaydn6773 Před rokem

    Perfect thank you

  • @ZX6R_SQUID
    @ZX6R_SQUID Před 9 měsíci +3

    Out of date now. The new unity package is different and i am full lost. even using the same release as you after failing with the new one i am getting errors of duplicate packages when i import the unity package.

  • @srunly7739
    @srunly7739 Před rokem

    Hello ! can you make the video tutorial how to enable the Platform Fee extension in thridweb ? thank you !

  • @ZGamesStudio
    @ZGamesStudio Před 11 měsíci

    Good Stuff I'm working on this and i need to get Token Prices from contract i have already set the prices 0.001 ETH for each token on Third web Contract but unable to read it so do you help me to get the prices of the token from contract in UNITY?

  • @dimmewestfingers9391
    @dimmewestfingers9391 Před 4 měsíci

    Using thirdweb in Unity, can i claim ERC20 tokens on both binance/ethereum mainnet and testnet, thanks

  • @leezabutt9662
    @leezabutt9662 Před 11 měsíci +1

    I am running into an error again and again while importing thirdweb unity sdk...
    Error is: PrecompiledAssemblyException:Multiple precompiled assemblies with the same name Newtonsoft.Json.dll included on the current platform.Only one assembly with same name is allowed per platform.
    The assembly with the same name is inside assets and libraries...kindly suggest me solution to resolve it.

  • @hades8131
    @hades8131 Před rokem

    Hey I wanna ask something let’s say I wanna create something like this if player collected 10000 in game coin he could collect 1 token so how can we do that please help?

  • @glassyguys6009
    @glassyguys6009 Před 8 měsíci

    How can I control token release? Since anyone can mint if they have a contract. i dont get this part .when we verified contract anyone know contract.then token drop contract is not erc-20 contract ?

  • @buzimamusic5545
    @buzimamusic5545 Před 8 měsíci

    Hi after doing all the steps in this video but provided I connect to the game using metamask when I click on the claim tokens will be minted from the contract into the connected wallet in the game?

    • @thirdweb_
      @thirdweb_  Před 8 měsíci

      Correct the claim will go to the wallet that is connected.

    • @buzimamusic5545
      @buzimamusic5545 Před 8 měsíci

      @@thirdweb_ For some reason I'm getting 2 transactions in 1 click😊

  • @umerasghar8520
    @umerasghar8520 Před 3 měsíci

    no autotask option on open zeppline

  • @ZGamesStudio
    @ZGamesStudio Před 11 měsíci

    Everytime i tried to do gasless transaction.Its throw this exception
    UnityException: Forward Request Failed!

    • @ZGamesStudio
      @ZGamesStudio Před 11 měsíci

      Using this relayer forward address: 0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81 but still facing the issue.

  • @Oliver-ik7eu
    @Oliver-ik7eu Před 11 měsíci

    A very wonderful and very useful tool, but I think that Unreal Engine is the best choice for games, so this tool must support the Unreal Engine system. Please provide us with information about when this can be done

    • @thirdweb_
      @thirdweb_  Před 11 měsíci

      Unreal Engine SDK is in our pipeline of future projects. Currently only Unity SDK 👍

  • @TheRealAfroRick
    @TheRealAfroRick Před rokem

    Why an ERC-20 instead on an 1155? While you start with one currency/resource, typically you may want multiple so wouldn't it make long-term planning to do this as an 1155 collection

    • @thirdweb_
      @thirdweb_  Před rokem +1

      ERC20 since it's a currency to be used. ERC1155 could also be used, but using something to consider would be gas. Depending on what you are trying to both can be used

    • @TheRealAfroRick
      @TheRealAfroRick Před rokem

      @@thirdweb_ Interesting. Okay. I didn't want to have to create a bunch of ERC-20s if I could fit all of the 'currencies' and products into one contract, but it's straightforward enough to implement that I'll try both approaches.

    • @Sathishkumar-kj5cq
      @Sathishkumar-kj5cq Před 6 měsíci +1

      How to restrict folks to directly mint from the token contract?
      And use only claim function within the game?
      Since it is free in your demo, once they claim a few tokens, they will be able to access contract details and then directly mint from the contract

  • @Falney
    @Falney Před rokem

    I may be stupid for asking this, but isn't it better to do everything server side for security reasons?

    • @sherpya
      @sherpya Před rokem

      yes but this tutorial focuses on the web3 part

    • @Falney
      @Falney Před rokem

      @@sherpya if you teach some one how to do something the wrong way, they will do it the wrong way. They don't need to make a whole tutorial on how to make a game nore do they need to make a tutorial on how to make a server, just how to use their tools in a responsible way.
      I am kind of fed up of hearing stories about hacking happening. All of it is because people expose vulnerabilities like this.

    • @sherpya
      @sherpya Před rokem

      @@Falney making a server requires different skills and a longer video, but two words how to make it in real world would have been better

    • @Falney
      @Falney Před rokem

      @@sherpya setting up a server should be a separate video. It's basically the same weather its for crypto or not.
      "we have this basic server that our game communicates with. You can find lots of tutorials on how to build servers on youtube. But once the server running, you do xy and z"

  • @zynn.2424
    @zynn.2424 Před rokem

    Still waiting for dex tutorial with thirdweb

  • @samadqamar2181
    @samadqamar2181 Před 8 měsíci

    hi, i am getting an error after setting up gasless transaction : UnityException: Forward Request Failed!

    • @samadqamar2181
      @samadqamar2181 Před 8 měsíci

      also is there a way to charge gas fees on windows build? becuase when i don't set gasless transaction the metamask prompt opens in webgl builds but not in windows build.

  • @UUproductionz
    @UUproductionz Před 4 měsíci

    does it have to be a 2d core project to make

    • @thirdweb_
      @thirdweb_  Před 3 měsíci +1

      This works with any types of Unity game

  • @jopadjr
    @jopadjr Před rokem

    20th...Thanks

  • @dewuzuo3932
    @dewuzuo3932 Před rokem

    I tried to follow the tutorial, but I don’t know how to do it in the last step. What should I fill in the forwarded adress? Your video is too fast and I can’t see it clearly😃

    • @thirdweb_
      @thirdweb_  Před rokem

      Apologies for that. The gasless forwarder address if not Goerli is: 0xc82BbE41f2cF04e3a8efA18F7032BDD7f6d98a81
      More info can be found in docs here:
      portal.thirdweb.com/glossary/gasless-transactions

  • @zoomwarmetaverse64
    @zoomwarmetaverse64 Před rokem +1

    make a similar game ue4/ue5 😮😊

    • @thirdweb_
      @thirdweb_  Před rokem +1

      UE4/UE5 support not available. But will make content once it is 👍

  • @mayabang01
    @mayabang01 Před rokem

    is unity thridweb sdk can use in unity Mobile game?

    • @thirdweb_
      @thirdweb_  Před rokem

      Yes, the Unity SDK supports web, mobile, and native platforms 👍

  • @mouhebize
    @mouhebize Před rokem

    In this line for exemple :
    var results = await contract.ERC20.Claim("5");
    i m facing this error :
    Error converting value "0xcaaf4re0df5e97104b03ddb72a8b930ca2b15959a910ca0bb1e65dcc9105b2d8" to type 'Thirdweb.RelayerResult'