|
Returns a resource at an asset path (Editor Only).
This function always return null in the standalone player or web player. This is useful for quickly accessing an asset for use in the editor only.
Note:
All asset names & paths in Unity use forward slashes, paths using backslashes will not work.
var prefab : GameObject;
function Start () {
prefab = Resources.LoadAssetAtPath("Assets/Artwork/mymodel.fbx", GameObject);
}
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
public GameObject prefab;
void Start() {
prefab = Resources.LoadAssetAtPath("Assets/Artwork/mymodel.fbx", typeof(GameObject));
}
}
import UnityEngine
import System.Collections
class example(MonoBehaviour):
public prefab as GameObject
def Start():
prefab = Resources.LoadAssetAtPath('Assets/Artwork/mymodel.fbx', GameObject)