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

Mappings from BuildTarget enum or string won't scale over different version of Unity #34

Open
Larusso opened this issue Nov 12, 2021 · 0 comments

Comments

@Larusso
Copy link
Member

Larusso commented Nov 12, 2021

Description

The idea behind this code is inherently broken. We can't really decuce the components from the selected build target. There are only a handfull of targets which have been stable over the last few years (ios, android, webgl).

The BuildTarget enum in Unity is changing or can change from version to version. Even worth, the component values are also bound to a Unity version. So one Unity has the component windows-mono the next one uses a different name.

static Component buildTargetToComponent(String target) {
Component component = Component.unknown
switch (target.toLowerCase()) {
case "android":
component = Component.android
break
case "ios":
component = Component.ios
break
case "tvos":
component = Component.tvOs
break
case "webgl":
component = Component.webGl
break
case "linux":
case "linux64":
case "linuxuniversal":
component = Component.linux
break
case "lumin":
component = Component.lumin
break
case 'osxuniversal':
component = Component.mac
break
case "win32":
case "win64":
if (!System.getProperty("os.name").toLowerCase().startsWith("windows")) {
component = Component.windows
}
break
}
component
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant