assetPath | Pathname of the target asset. |
type | Type filter for objects returned. |
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 and paths in Unity use forward slashes, paths using backslashes will not work.
This returns only asset object that is visible in the Project view.
var prefab : GameObject;
function Start () { prefab = Resources.LoadAssetAtPath("Assets/Artwork/mymodel.fbx", GameObject); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public GameObject prefab; void Start() { prefab = (GameObject) Resources.LoadAssetAtPath("Assets/Artwork/mymodel.fbx", typeof(GameObject)); } }
Note that web player is not supported from 5.4.0 onwards.
assetPath | Pathname of the target asset. |
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 and paths in Unity use forward slashes, paths using backslashes will not work.
This returns only asset object that is visible in the Project view.
var prefab : GameObject;
function Start () { prefab = Resources.LoadAssetAtPath.<GameObject>("Assets/Artwork/mymodel.fbx"); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { public GameObject prefab; void Start() { prefab = Resources.LoadAssetAtPath<GameObject>("Assets/Artwork/mymodel.fbx"); } }
Note that web player is not supported from 5.4.0 onwards.