GetFile
Introduction
Texture2D texture = (Texture2D)GetFile("Bear");Song song = (Song)GlobalContent.GetFile("BattleSong");Why use GetFile
Texture2D texture = Bear;// Assuming EnemyInfo is a valid variable with a Texture that is a string
string fileName = EnemyInfo.Texture;
Texture2D texture = (Texture2D)GetFile(fileName);// Assuming that LevelNumber is a valid int:
var level = (Scene)GetFile("Level" + LevelNumber);Accessing GetFile from different locations
1. Calling GetFile with a live instance of the screen/entity that contains the files
2. Calling GetFile without an instance of the screen/entity that holds the file
Last updated
Was this helpful?
