I don't need to test my programs. I have an error-correcting modem.
DynamicLoadObject is a native function declared in Object. It loads an object of a specified class. Which object of that class is specified as a string. The string is the name of the thing that you want to load. If that thing does not exist in memory, it will be loaded from the appropriate package file.
DynamicLoadObject is used almost exclusively to load a resource based on a name supplied as a string. For example, xPlayers.int (UT2003) contains a list of players, each of which has a model, skin, etc. The model name, skin name, and so forth are read in as strings. Then, DynamicLoadObject is used to get Mesh and Material references based on those strings. The reason why they are stored like this is it allows a class to use things that did not exist at compile time, (such as 3rd party models) or classes that exist at compile time, but are not visible from the class compiling time because the class it refers to is compiled after this class.
native static final function object DynamicLoadObject( string ObjectName, class ObjectClass, optional bool MayFail );
ObjectName is the name of the object. For instance, "Engine.DefaultTexture" or "xInterface.ExtendedConsole".
ObjectClass is the class of the thing that you are loading. So, for "Engine.DefaultTexture" the ObjectClass would be class'Engine.Material' or class'Engine.Texture'. For "xInterface.ExtendedConsole" it would be class'Class'. (A class is itself a class... called class.) If MayFail is false or is omitted, and the object cannot be loaded, a warning will be printed to the log file. If MayFail is true, no warning will be printed if the object cannot be loaded.
local class<Actor> aClass< SEMI > local Actor A; aClass = class<Actor>(DynamicLoadObject("MyPackage.MyActorClass", class'Class')); A = Spawn(aClass);
local class<UWindowList> ListClass< SEMI > local UWindowList L; ListClass = class<UWindowList>(DynamicLoadObject("MyPackage.MyList", class'Class')); L = New ListClass< SEMI >
local Texture T; T = Texture(DynamicLoadObject("MyPackage.MyTexture", class'Texture'));
local Sound S; S = Sound(DynamicLoadObject("MyPackage.MySound", class'Sound'));
Category:Legacy To Do – Determine if this page has been properly linked to, if not link up or rework info into relevant pages (i.e., Object)