-
Notifications
You must be signed in to change notification settings - Fork 350
Subclassing
Nako Sung edited this page Nov 23, 2015
·
10 revisions
You can subclass any UClass like creating a blueprint in the editor. Just like blueprints, given class is transformed into JavascriptGeneratedClass
by require('class')()(global,SourceClass)
.
class MyUObject extends UObject {
ctor() {
this.Prop = 'Good'
}
properties() {
this.Prop/*EditAnyWhere+string*/;
}
}
let MyUObject_C = require('uclass')()(global,MyUObject)
let instance = new MyUObject()
class MyActor extends Actor {
// overriding existing event
// function signature is not needed for overriding;
// because we already know it!
ReceiveBeginPlay() {
super.ReceiveBeginPlay()
console.log("Hello")
}
Client_PlayFX(effect/*string*/) /*NetMulticast*/ {
console.log("fire!")
}
}
let MyUObject_C = require('uclass')()(global,MyActor)
let actor = new MyActor(GWorld)
You may create a class derived from a blueprint.
class MyBPChild extends Blueprint.Load('/Game/MyBP').GeneratedClass {
}