Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Bug Override with JEXL expression not working

Discussion in 'Unity Remote Config' started by tessellation, Mar 3, 2023.

  1. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    395
    This works with Javascript to compare an int with a string, but doesn't seem to work in JEXL when I test this in our app with build number "129"

    I'm assuming the Remote Config runtime creates this unity JSON: { "appBuildVersion": "129" }

    So the Override has JEXL condition: unity.appBuildVersion > 127

    However, the Remote Config keys are not being correctly overridden on Android. The Simulation Tool isn't working at the moment so I can only test this on Android builds. What am I doing wrong?
     
  2. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    395
    I found the problem. I looked at the latest Remote Config Runtime v3.1.3 package code in the ConfigManagerImpl.UnityAttributes class and it never sets "appBuildVersion!" So the JEXL documentation seems sorely outdated (missing many properties that are set in UnityAttributes) and the code doesn't match the document (appBuildVersion missing). This means the simulation misleadingly works because it has developers manually enter the 'unity' attributes JSON, whereas obviously the app generates it in the code.
     
  3. vd_unity

    vd_unity

    Unity Technologies

    Joined:
    Sep 11, 2014
    Posts:
    43
    Hi @tessellation, thanks for pointing this out!
    JEXL documentation is indeed outdated, and it will be soon corrected, for what is worth, I just checked current attributes sent by RC, which could be JEXL utilized:

    "attributes": {
    "unity": {
    "osVersion": "Mac OS X 11.6.0",
    "appVersion": "0.1",
    "rootedJailbroken": false,
    "model": "MacBookPro16,1",
    "cpu": "Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz",
    "cpuCount": 16,
    "cpuFrequency": 2300,
    "ram": 32768,
    "vram": 8176,
    "screen": "3584 x 2240 @ 60Hz",
    "dpi": 264,
    "language": "en",
    "appName": "com.DefaultCompany.rotatingCube",
    "appInstallMode": "Editor",
    "appInstallStore": "",
    "graphicsDeviceId": 0,
    "graphicsDeviceVendorId": 0,
    "graphicsName": "AMD Radeon Pro 5500M",
    "graphicsDeviceVendor": "Apple",
    "graphicsVersion": "Metal",
    "graphicsShader": 50,
    "maxTextureSize": 16384,
    "platform": "OSXEditor"
    }

    Any of those keys can be used, but as you correctly stated, appBuildVersion key does not exist, closest to it is probably appVersion.

    This will be corrected from the docs
     
  4. tessellation

    tessellation

    Joined:
    Aug 11, 2015
    Posts:
    395
    Feature Request: add a JEXL method to compare compound version number strings like VersionIsAtLeast(unity.appVersion, "1.24.8") So anything greater than 2 for the first part works or if a "1" then second part must be 24 or more and if 24 then the 3rd part must be 8 or more. Etc if there are more parts.

    Build numbers are nice because you can just do a simple > or < integer comparison. For now we are passing the build number in the app configuration but we're having to jump through a lot of hoops to get the build number (see https://forum.unity.com/threads/get-build-number-from-a-script.641725/#post-8857090).