Search Unity

Change inspector value from build script

Discussion in 'Scripting' started by waldgeist, Dec 20, 2019.

  1. waldgeist

    waldgeist

    Joined:
    May 6, 2017
    Posts:
    388
    I have a custom build script that auto-adjusts the Unity mobile app to the URLs of different target servers, based on which menu item I choose. The URLs of these servers are maintained as a property of a script in the Editor, so I can tweak them using the Inspector.

    However, I haven't found a way to access these values programmatically from my build script, during build time (the app is not playing at this time). Is this possible?
     
  2. Joe-Censored

    Joe-Censored

    Joined:
    Mar 26, 2013
    Posts:
    11,847
    I'm not aware of a way, but I just use a config file in the StreamingAssets folder for this kind of data. If updated data is in the config file at runtime, use that, otherwise use the inspector value.