Unrealscript defaultproperties Block :
- Purpose of the defauldproperties block is initialize variables default values.
- Example: If you crated variable: var int x;
- You should initialize the variable "x" inside the defauldproperties. x=9
- In unrealscript you cannot initialize values outside. (But inside a functions in some cases).
Example:
class TestDefBlock extends Object
//Declare integer variable called x
var int x;
defaultproperties{
//Initialize a value to the variable x
x=9
}
So the defaultproperty block calls soon as the class runs.
It is similes to constructor if you come from object-oriented programming language like java or c++
But unlike constructor method, you cannot call a function inside the defaultproperty block just initialize values
Inside defaultproperty block you can initialize:
class TestDefBlock extends Object
//Declare integer variable called x
var int x;
defaultproperties{
//Initialize a value to the variable x
x=9
}
So the defaultproperty block calls soon as the class runs.
It is similes to constructor if you come from object-oriented programming language like java or c++
But unlike constructor method, you cannot call a function inside the defaultproperty block just initialize values
Inside defaultproperty block you can initialize:
- Simple Types (Ints, Floats, Bools, Bytes)
- Static Arrays
- Dynamic Arrays
- Objects
- Subobjects
- Structs (including Vectors, Rotators, etc.)
Learn How to declare those things inside defauldproperty block and more:
No comments:
Post a Comment