FAST SDK Coding Reference 1.0.3
Loading...
Searching...
No Matches
AssetFromFile Class Referenceabstract

A base class to help use an asset loaded from the file system for the current skin in multiple languages. More...

Inheritance diagram for AssetFromFile:
AudioClipFromFile AudioSourceFromFile ImageFromFile ImagePlayerFromFile SpriteFromFile TextureFromFile VideoPlayerFromFile

Classes

class  ImageSettings
 A class for storing the image file import settings used by the Unity Editor. It ensures that the image settings used when loading from file at runtime will match the import settings used by the Editor. More...
 

Public Member Functions

void Load (string language)
 Loads the asset from FAST.Application.assets dictionary using language and FAST.AssetFromFile.fileName.
 

Public Attributes

string baseFileName
 Inspector, Code
The name of the asset with the file extension, but without the prefix or suffix.
 

Static Public Attributes

const string kSharedLanguage = "Shared"
 Use this string as the language name for assets that are the same across all languages and can be shared.
 

Protected Member Functions

virtual void Awake ()
 When the script is loaded, FAST.AssetFromFile.UpdateFileName(string) is called to initialize FAST.AssetFromFile.fileName.
 
void LogAssetNotLoadedError ()
 Call this to log an error when an FAST.AssetFromFile cannot be loaded.
 
void SetNameWithFileExtension ()
 When you right-click on FAST.AssetFromFile.baseFileName in the Inspector, this function will run in the Editor to get the filename of an asset assigned to a corresponding Component.
 
void UpdateFileName (string language)
 Updates FAST.AssetFromFile.fileName using language, FAST.AssetSettings, FAST.AssetFromFile.prefixFileName, FAST.AssetFromFile.baseFileName, and FAST.AssetFromFile.suffixFileName.
 

Protected Attributes

string fileName
 Runtime
The full file name combined from the FAST.AssetFromFile.prefixFileName, FAST.AssetFromFile.baseFileName, and FAST.AssetFromFile.suffixFileName at runtime.
 
bool isSharedByAllLanguages
 Inspector
Set to true if this asset is the same across all languages and can be shared.
 
string prefixFileName
 Settings
A string loaded from FAST.AssetSettings that will be added to the front of the FAST.AssetFromFile.baseFileName at runtime.
 
string suffixFileName
 Settings
A string loaded from FAST.AssetSettings that will be inserted to the end of the FAST.AssetFromFile.baseFileName, but before the extension, at runtime.
 

Static Protected Attributes

const string kLanguageTag = "#Language"
 Use this string in the FAST.AssetSettings.prefixFileName or FAST.AssetSettings.suffixFileName to be replaced with the FAST.Application.language at runtime.
 
const string kProductNameTag = "#ProductName"
 Use this string in the FAST.AssetSettings.prefixFileName or FAST.AssetSettings.suffixFileName to be replaced with the UnityEngine.Application.productName at runtime.
 
const string kSkinTag = "#Skin"
 Use this string in the FAST.AssetSettings.prefixFileName or FAST.AssetSettings.suffixFileName to be replaced with the FAST.AssetSettings.skin at runtime.
 

Detailed Description

A base class to help use an asset loaded from the file system for the current skin in multiple languages.

Assets are stored in FAST.Application.assets dictionary. This class will load the asset by looking it up in the dictionary using language in FAST.AssetFromFile.Load(string) and FAST.AssetFromFile.fileName.

See also
UnityEngine.Application

Member Function Documentation

◆ Awake()

virtual void Awake ( )
protectedvirtual

◆ Load()

void Load ( string language)
abstract

Loads the asset from FAST.Application.assets dictionary using language and FAST.AssetFromFile.fileName.

Parameters
languageThe language of the asset to load.

◆ LogAssetNotLoadedError()

void LogAssetNotLoadedError ( )
protected

Call this to log an error when an FAST.AssetFromFile cannot be loaded.

◆ SetNameWithFileExtension()

void SetNameWithFileExtension ( )
abstractprotected

When you right-click on FAST.AssetFromFile.baseFileName in the Inspector, this function will run in the Editor to get the filename of an asset assigned to a corresponding Component.

When creating a new derived class, override this function by surrounding the implementation with a UNITY_EDITOR conditional compilation directive.

#if UNITY_EDITOR
override protected void SetNameWithFileExtension()
{
component = GetComponent<Component>();
baseFileName = Path.GetFileName(AssetDatabase.GetAssetPath(component.asset.GetInstanceID()));
UnityEditor.SceneManagement.EditorSceneManager.MarkSceneDirty(gameObject.scene);
}
#endif
void SetNameWithFileExtension()
When you right-click on FAST.AssetFromFile.baseFileName in the Inspector, this function will run in t...
string baseFileName
Inspector, Code The name of the asset with the file extension, but without the prefix or suffix.
Definition AssetFromFile.cs:117

◆ UpdateFileName()

void UpdateFileName ( string language)
protected

Updates FAST.AssetFromFile.fileName using language, FAST.AssetSettings, FAST.AssetFromFile.prefixFileName, FAST.AssetFromFile.baseFileName, and FAST.AssetFromFile.suffixFileName.

Parameters
languageThe language to use for the fileName.

Member Data Documentation

◆ baseFileName

string baseFileName

Inspector, Code
The name of the asset with the file extension, but without the prefix or suffix.

For example: if the full filename is "FAST-QuizShow-Mars-EN-Player1-Join.png" then the baseFilename would be "Player1-Join.png".

◆ fileName

string fileName
protected

Runtime
The full file name combined from the FAST.AssetFromFile.prefixFileName, FAST.AssetFromFile.baseFileName, and FAST.AssetFromFile.suffixFileName at runtime.

◆ isSharedByAllLanguages

bool isSharedByAllLanguages
protected

Inspector
Set to true if this asset is the same across all languages and can be shared.

◆ kLanguageTag

const string kLanguageTag = "#Language"
staticprotected

Use this string in the FAST.AssetSettings.prefixFileName or FAST.AssetSettings.suffixFileName to be replaced with the FAST.Application.language at runtime.

◆ kProductNameTag

const string kProductNameTag = "#ProductName"
staticprotected

Use this string in the FAST.AssetSettings.prefixFileName or FAST.AssetSettings.suffixFileName to be replaced with the UnityEngine.Application.productName at runtime.

See also
UnityEngine.Application.productName

◆ kSharedLanguage

const string kSharedLanguage = "Shared"
static

Use this string as the language name for assets that are the same across all languages and can be shared.

◆ kSkinTag

const string kSkinTag = "#Skin"
staticprotected

Use this string in the FAST.AssetSettings.prefixFileName or FAST.AssetSettings.suffixFileName to be replaced with the FAST.AssetSettings.skin at runtime.

◆ prefixFileName

string prefixFileName
protected

Settings
A string loaded from FAST.AssetSettings that will be added to the front of the FAST.AssetFromFile.baseFileName at runtime.

For example: if the full filename is "FAST-QuizShow-Mars-EN-Player1-Join.png" then the prefixFileName would be "FAST-QuizShow-Mars-EN-". When using hastags, the prefixFileName might be specified as "#ProductName-#Skin-#Language-".

See FAST.AssetFromFile.kProductNameTag, FAST.AssetFromFile.kSkinTag, FAST.AssetFromFile.kLanguageTag for more info about hashtags.

◆ suffixFileName

string suffixFileName
protected

Settings
A string loaded from FAST.AssetSettings that will be inserted to the end of the FAST.AssetFromFile.baseFileName, but before the extension, at runtime.

For example: if the full filename is "Player1-Join-FAST-QuizShow-Mars-EN.png" then the suffixFileName would be "-FAST-QuizShow-Mars-EN". When using hastags, the suffixFileName might be specified as "-#ProductName-#Skin-#Language".

See FAST.AssetFromFile.kProductNameTag, FAST.AssetFromFile.kSkinTag, FAST.AssetFromFile.kLanguageTag for more info about hashtags.


The documentation for this class was generated from the following file: