You may all know how to implement dynamic loading of resources in Unity3d, that is, to put resources in the resource directory, using the Resources.load method can dynamically load resources. But there is a problem with resources in the resource directory, and that is, when the package is packaged, all the files in the directory will be encrypted and compressed into the package, so that if we want to use the Assetbundle way to play the packet. I've been thinking about this a lot lately, while looking at the API documentation recently, I found a method called Resources.loadassetatpath, which allows you to load resources from any location in the assets directory, but only in editor mode. With this approach, we can load resources using two different policies when testing and publishing: Dynamically loading resources using the Resources.loadassetatpath method in the editor test environment, and loading dynamic resources in a publishing environment using the assetbundle approach.
unity3d--defines the projection matrix of the camera http://www.linuxidc.com/Linux/2013-04/82566.htm
Unity3d the distinction of several default functions http://www.linuxidc.com/Linux/2012-07/66012.htm
Unity3d a script that sets the arrow keys to move and space to jump http://www.linuxidc.com/Linux/2012-07/66011.htm
Unity3d add scripting code to Objects (Gameobject) http://www.linuxidc.com/Linux/2012-07/66010.htm
The following code fragment is posted:
Dynamically loading prefab by Resources.loadatpath method
private void Loadprefabbyresources ()
{
Object prefab = Resources.loadassetatpath ("Assets/prefabs/cube.prefab", typeof (Gameobject));
Gameobject cube = (gameobject) instantiate (prefab);
Cube.transform.parent = transform;
}
At the same time I made a simple example, download the address:
free download address in http://linux.linuxidc.com/
both the username and password are www.linuxidc.com
download Directory in /2014/June/17th/unity3d in the dynamic loading resources outside the resource directory
Download method See http://www.linuxidc.com/Linux/2013-07/87684.htm
PS: The Tools folder in the project directory contains a HFS.exe that is a small tool for simulating HTTP file services locally. With it you can map local files to files that HTTP can access.