I'm trying to load an asset using Resources.load() but it always returns null.
Here is my folder structure: https://imgur.com/a/z8KObW1
When I use Resources.load() in my unity project, it works without any problem. But when I create a seperate project in visual studio with the unityengine dll's, and use Resources.load() in one of the .cs files under the Source folder it always seems to return null, no matter what I try.
When I placed the Assets folder inside of the Source folder it returned null and when I placed the .cs files in the Asset folder it also returned null. I can't seem to figure out why. I also tried to fetch the path that the Resources.load() starts at, but I can't seem to figure it out. Does it start from the .dll or from the .cs file under the Source?
public static void Create_Manager() {
GameObject networkManagerObj = new GameObject();
networkManagerObj.name = "_NetworkManager";
networkManager = networkManagerObj.AddComponent<NetworkManager>();
networkManager.playerPrefab = Resources.Load("Player") as GameObject;
networkManager.dontDestroyOnLoad = true;
networkManager.runInBackground = true;
networkManager.autoCreatePlayer = true;
}
All I need is for the Resources.load() to work with my seperate project/dll. Does anyone know how to do so?
Here's the code that a coworker of mine wrote and mostly explained to me. I've omitted a lot of the code that dealt with what this class was for (handling touch input), leaving only the sections related to loading an image (used to display a touch point on screen).
It first attempts to load an image out of the Resources folder (as you're familiar with) at a given location: this allows the image to be overridden by the local project, if desired. If that image isn't found, then it loads one out of the DLL. I am not sure where this image is located, but as the path reference is in the code, I'm sure it works out sensibly enough (the key part he had informed me was how to insure that the file got included in the DLL, rather than where it was located).
The important chunk for loading it out of the DLL is this section: