Class DynamicAddressableLoadPathSystem
Dynamically overrides the Addressables remote load path at runtime. Registers a persistent InternalIdTransformFunc on the Addressables ResourceManager that rewrites remote asset URLs to use RuntimeBaseUrl. Only one instance should exist in the scene — the last one to Awake wins.
Client builds with an empty or loopback RuntimeBaseUrl do not register a rewrite: Addressables.RuntimePath already resolves correctly (including WebGL, where StreamingAssets is an absolute http(s) URL derived from the page origin, e.g. https://fishmmo.com/test/StreamingAssets/aa). Rewriting those IDs to a hardcoded host (or prefixing file://) breaks loads when the game is served from a different domain or subpath.
public class DynamicAddressableLoadPathSystem : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourDynamicAddressableLoadPathSystem
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Properties
RuntimeBaseUrl
The base URL to use for remote Addressables asset loading at runtime. When set to a real CDN URL on client builds, overrides the profile's remote load path. When left empty (or set to a loopback placeholder), client builds keep Addressables' default local StreamingAssets resolution and do not rewrite http(s) IDs. Trailing slash is normalized automatically on set. Cannot be set to null or empty after the transform is registered.
public string RuntimeBaseUrl { get; set; }
Property Value
Methods
IsLoopbackPlaceholder(string)
Returns true if the given URL is a loopback/localhost placeholder address that should be replaced with a local path on client builds. Uses System.Uri for exact host comparison to avoid substring false-positives.
public static bool IsLoopbackPlaceholder(string url)
Parameters
urlstringThe URL to check.
Returns
- bool
True if the URL's host is a loopback address.
ToLoadBaseUrl(string)
Builds a load-base URL for Addressables.RuntimePath / StreamingAssets. WebGL (and any platform where StreamingAssets is already http/https) must not receive a file:// prefix — that produces invalid IDs like file://https://host/StreamingAssets/aa/...
public static string ToLoadBaseUrl(string path)
Parameters
pathstring