| Home Page | Recent Changes | Preferences

# DynamicLoadObject

#### What's the use?

At this moment I can only think of 2 things you need it for:

- Getting class names from strings so you can make dynamic arrays of classes
- 'Reference' to objects you can't really 'see' yet. (as in the compiler hasn't loaded them yet)

#### How to do it?

From Object.UC

    native static final function object DynamicLoadObject( string ObjectName, class ObjectClass, optional bool MayFail );

It basicly needs a string that holds the object name, and the 'class' of the object to function.

(Does anyone know what the 'MayFail' does?)

#### Examples

    local class<Actor> aClass;
    local Actor A;

    aClass = class<Actor>(DynamicLoadObject("MyPackage.MyActorClass", class'Class'));
    A = Spawn(aClass);

    local class<UWindowList> ListClass;
    local UWindowList L;

    ListClass = class<UWindowList>(DynamicLoadObject("MyPackage.MyList", class'Class'));
    L = New ListClass;

    local Texture T;

    T = Texture(DynamicLoadObject("MyPackage.MyTexture", class'Texture'));

    local Sound S;

    S = Sound(DynamicLoadObject("MyPackage.MySound", class'Sound'));

#### Comments

Daid303:I searched for DynamicLoadObject and didn't find a page called like that, most of the info is also on [Typecasting] but this makes searching easier.

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In