I don't know how to contribute in gitHub, so I'm just posting this problem with its solving method of mine as an issue.
SmartReference will not work with Unity Resources in current 1.0.0 version, this is why:
using System;
using UnityEngine;
using Object = UnityEngine.Object;
namespace SmartReference.Runtime {
public class ResourcesLoader: ISmartReferenceLoader {
public Object Load(string path, Type type) {
string relativePathWithoutExtension = path.Substring(0, path.LastIndexOf('.'));
relativePathWithoutExtension = relativePathWithoutExtension.Split("Resources/")[1];
return Resources.Load(relativePathWithoutExtension, type);
}
public void LoadAsync(string path, Type type, Action<Object> callback)
{
string relativePathWithoutExtension = path.Substring(0, path.LastIndexOf('.'));
relativePathWithoutExtension = relativePathWithoutExtension.Split("Resources/")[1];
var request = Resources.LoadAsync(path, type);
request.completed += _ => callback?.Invoke(request.asset);
}
}
}
I'm such a code monkey so maybe I'm using bad method of trimming strings, but this works fine.