Search Unity

Change Addressable path of a prefab from Editor script

Discussion in 'Addressables' started by labandunga, Jun 9, 2019.

  1. labandunga

    labandunga

    Joined:
    Aug 1, 2012
    Posts:
    29
    I'd like to change the addressable path of a prefab from my editor script.

    What call can I use for this?
     
  2. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464
    +1, so we can write some scripts to automate addressables import.
     
  3. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    Start with https://docs.unity3d.com/Packages/c...ts.AddressableAssetSettingsDefaultObject.html to get the current settings object. From there you'll want to interact with the classes here: https://docs.unity3d.com/Packages/c...i/UnityEditor.AddressableAssets.Settings.html such as AddressableAssetSettings, AddressableAssetGroup, and AddressableAssetEntry

    I'd also recommend looking through our GUI code to see what we do. For the most part, our GUI code is calling public API on the settings object. So you can replicate any of that in your own code.
     
    Favo-Yang likes this.
  4. Favo-Yang

    Favo-Yang

    Joined:
    Apr 4, 2011
    Posts:
    464