| Home Page | Recent Changes

UnrealScript For Java Programmers

Notes for Java developers:

Basics

  • UnrealScript is not case sensitive (except for the content of string variables)
  • Variables are implicitly initialized with a null value (e.g. 0, "", None or the first element of an enum) and cannot be initialized explicitely except for class variables. (see Default Properties)
  • There are no Object versions of the primitive variable types
  • String is a primitive type, not an Object
  • Arrays, whether static or dynamic, and structs are always passed by value, i.e. copied
  • Enums are "glorified bytes", not special objects like in Java 5.0
  • Function parameters and variable assignment work by value, like in Java. (Not even the 'out' parameter modifier changes this! It merely copies the parameter's new value back after the function returns.)
  • Function parameters can be optional if they are the last parameter or are only followed by optional parameters.
  • Class variables, enums and structs must be declared above any function declarations.
  • Local variables must be declared at the beginning of a function before any executable code statements.
  • No Java 5.0 features like generics, annotations or the '...' syntax for function parameters
  • UnrealScript is strictly single inheritance without interface classes, it does have a way to declare nested classes, though. (see Within and Class Syntax)
  • States and state code
  • Functions cannot be overloaded, only overridden
  • Calls to super class functions can be used anywhere within a class and may not only point to the direct super class, but also to any of its ancestors, as long as the specified class implements or inherits the function to call.
  • "Abstract" functions are identical to functions with and empty code block and are allowed in non-abstract classes.
  • vect(x,y,z) and rot(p,y,r) are literals for vector and rotator structs respectively. They are not function calls and only accept float and int literals respectively as parameters.

Initialization

Unlike most java libraries, there is no true initialization hook outside of the default properties section for Actor classes. DefaultProperties initialization works for primitives and passed-by-value complex objects only. You cannot configure complex class instances there and pass them by reference. If you need to initialize a complex object, you can do so in Pre/Post begin play–but those methods are not called in the editor, so they can't be used to setup editable defaults.

Related Topics

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

FAQs

Help Desk

Mapping Topics

Mapping Lessons

UnrealEd Interface

UnrealScript Topics

UnrealScript Lessons

Making Mods

Class Tree

Modeling Topics

Chongqing Page

Log In