Version: Unity 6.5 (6000.5)
LanguageEnglish
  • C#

Resource Constructor

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public Resource(string name);

Parameters

Parameter Description
name Asset catalog entry name for this resource.

Description

Creates a file resource with the specified name, without a source file path.

Use this constructor when you intend to supply device-specific files using Resource.BindVariant. Don't use this constructor if the resource has a single source file; use the two-parameter constructor instead.


Declaration

public Resource(string name, string path);

Parameters

Parameter Description
name Asset catalog entry name for this resource.
path Path to the source file to include in the asset catalog.

Description

Creates a file resource with the specified name and source file path.

Unity copies the file at path into the UnityData.xcassets catalog under name. Don't call Resource.BindVariant on a resource created with this constructor; doing so throws an exception.