This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SortedCreatedAssets : MonoBehaviour | |
{ | |
[SerializeField] private List<string> _labels = new List<string>(){}; | |
void Start() | |
{ | |
SortWaitToCreate(_labels); | |
} | |
private async Task SortWaitToCreate(List<string> labels) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Threading.Tasks; | |
using UnityEngine; | |
using UnityEngine.AddressableAssets; | |
public class LoadAssetsFromRemote : MonoBehaviour | |
{ | |
[SerializeField] private string _label; | |
void Start() | |
{ | |
Get(_label); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CreatedAssets : MonoBehaviour | |
{ | |
[SerializeField] private List<string> _labels = new List<string>(); | |
[SerializeField] private List<GameObject> Assets { get; } = new List<GameObject>(); | |
private void Start() | |
{ | |
CreateAndWaitUntilCompleted(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task SearchByLabels<T>(List<string> labels, bool removeDupes, List<T> createdObjs) | |
where T : Object | |
{ | |
IList<IResourceLocation> locations = new List<IResourceLocation>(); | |
foreach (var label in labels) | |
{ | |
foreach (var resourceLocation in await Addressables.LoadResourceLocationsAsync(label).Task) | |
locations.Add(resourceLocation); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CreateAddressablesLoader | |
{ | |
public static async Task SearchByLabels<T>(List<string> labels, bool removeDupes, List<T> createdObjs) | |
where T : Object | |
{ | |
IList<IResourceLocation> locations = new List<IResourceLocation>(); | |
foreach (var label in labels) | |
{ | |
foreach (var resourceLocation in await Addressables.LoadResourceLocationsAsync(label).Task) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task InitAssets<T>(string assetNameOrLabel, List<T> createdAssets) | |
where T : Object | |
{ | |
var locations = await Addressables.LoadResourceLocationsAsync(assetNameOrLabel).Task; | |
foreach (var location in locations) | |
createdAssets.Add(await Addressables.InstantiateAsync(location).Task as T); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CreatedAssets : MonoBehaviour | |
{ | |
[SerializeField] private string _label; | |
[SerializeField] private string _assetName; | |
private List<GameObject> Assets { get; } = new List<GameObject>(); | |
private void Start() | |
{ | |
CreateAndWaitUntilCompleted(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class CreateAddressablesLoader | |
{ | |
public static async Task ByName<T>(string assetName, List<T> createdObjs) | |
where T : Object | |
{ | |
var locations = await Addressables.LoadResourceLocationsAsync(assetName).Task; | |
Debug.Log(locations); | |
createdObjs.Add(await Addressables.InstantiateAsync(locations[0]).Task as T); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static async Task ByName<T>(string label, string name, List<T> createdObjs) | |
where T : Object | |
{ | |
var locations = await Addressables.LoadResourceLocationsAsync(name).Task; | |
foreach (var location in locations) | |
{ | |
if (!location.PrimaryKey.Contains(name)) break; | |
createdObjs.Add(await Addressables.InstantiateAsync(name).Task as T); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class CreatedAssets : MonoBehaviour | |
{ | |
[SerializeField] private string _label; | |
private List<GameObject> Assets { get; } = new List<GameObject>(); | |
private void Start() | |
{ | |
CreateAndWaitUntilCompleted(); | |
} |
NewerOlder