Legacy Documentation: Version 4.6(go to latest)
Language: English
  • C#
  • JS
  • Boo

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Resources.LoadAssetAtPath

public static function LoadAssetAtPath(assetPath: string, type: Type): Object;

Parameters

assetPath Pathname of the target asset.
type Type filter for objects returned.

Description

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); }
public static function LoadAssetAtPath(assetPath: string): T;

Parameters

assetPath Pathname of the target asset.

Description

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.<GameObject>("Assets/Artwork/mymodel.fbx"); }