Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unity Scripting Define Symbol #827

Open
WoodsFiend opened this issue May 4, 2024 · 0 comments
Open

Unity Scripting Define Symbol #827

WoodsFiend opened this issue May 4, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@WoodsFiend
Copy link

WoodsFiend commented May 4, 2024

Feature Request

Add a versioned scripting define symbol such as METAMASK_{Version Number} to the Unity project settings when Metamask Unity is installed.

Why it is needed

  1. This allows developers to conditionally compile code for tools that are designed with an optional feature to use Metamask Unity.
  2. Scripts made using these scripting defines can be more easily upgraded to support the latest Metamask Unity version.

Possible implementation

Add a csc.rsp file in Assets/ with contents

 -define:METAMASK_V1

Code sample

Code can be conditionally compiled when Metamask is included in the Unity project. The version should be increased any time there is major changes.

#if METAMASK_V1
    //Metamask version 1 specific code
#elif METAMASK_V2
    //Metamask version 2 specific code
#endif 

Example

This example script shows usage of a manually added METAMASK scripting define symbol. The script can exist in the project, without compilation errors, when Metamask Unity is not installed and the METAMASK scripting define has not been added.
https://github.com/WoodsFiend/Moralis-Unity-SDK/blob/master/Scripts/MetaMask/MetaMaskProxyServerLogin.cs

@WoodsFiend WoodsFiend added the enhancement New feature or request label May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant