allartprotocol / unity-solana-wallet

The First Open-Source Unity-Solana Wallet with NFT support
282 stars 128 forks source link

[You are trying to create a MonoBehaviour using the 'new' keyword] #25

Closed rickCoin closed 2 years ago

rickCoin commented 2 years ago

I have done the "Step-by-step instructions" and I got those warnings. I can run it but when I click the wallet icon nothing happened. image

These are the warning description:

You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all UnityEngine.MonoBehaviour:.ctor () WebSocketService:.ctor () AllArt.Solana.WalletBaseComponent:Awake () (at D:/Unity/libs/unity-solana-wallet/Runtime/codebase/WalletBaseComponent.cs:57) AllArt.Solana.Example.SimpleWallet:Awake () (at Assets/Samples/Solana Wallet/1.0.0/Simple Wallet/Solana Wallet/1.0.0/Simple Wallet/script/example/SimpleWallet.cs:18)

vuckovic95 commented 2 years ago

Can you tell me more? Screenshot of scene hierarchy, prefabs which you imported into the scene?

vuckovic95 commented 2 years ago

Warnings fixed. For other problems I need more information.

MaciejProkopowicz commented 2 years ago

It allows scene to play now but overall functionality does not work... Doesn't show properly amount of SOL of imported wallet. Cannot send. Just nothing happens. Exports private key in format that its not possible to import to phantom. Tried on mainnet as well but same results appears....

It would be great if we could hook phantom wallet to unity. That would solve all my problems so I can focus on game development. Any clue ?

image

rickCoin commented 2 years ago

@vuckovic95 thanks for the reply, I have checkout the newest origin/main and the wallet still didn't work. This is the scene hierarchy and prefabs: image After I click the play bottom and click the wallet, it just has no action, so I'm stuck on it. image

I also saw the onClick() in walletbtn is empty, is it normal? image

Correct me if I did something wrong, thanks.

vuckovic95 commented 2 years ago

Step-by-step updated. You need EventSystem in your scene. Just create new canvas and drag WalletHolder into the created canvas.

vuckovic95 commented 2 years ago

@MaciejProkopowicz I'll solve it soon

vuckovic95 commented 2 years ago

@MaciejProkopowicz Export private key fixed

MaciejProkopowicz commented 2 years ago

@vuckovic95 Amazing. Thanks Mate ! Let's build some amazing stuff on Solana ! Let me know when I can test it out :)

vuckovic95 commented 2 years ago

You can right now :D