Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass parameters in constructor or ctor function after using require('uclass')()(global, )? #251

Open
hamkoo opened this issue May 23, 2019 · 2 comments

Comments

@hamkoo
Copy link

@hamkoo hamkoo commented May 23, 2019

No description provided.

@hamkoo

This comment has been minimized.

Copy link
Author

@hamkoo hamkoo commented May 23, 2019

_part_0_ue.d.ts

declare class UObject {
constructor();
constructor(Outer: UObject);
}
declare class Actor extends UObject {
constructor(InWorld: World, Location?: Vector, Rotation?: Rotator);
}

with constructor functions defined above, it can pass some parameters as follow:

class MTestActor extends Actor{
}
let act = new Actor_C(GWorld, {Z:200});

but, how can i pass customer parameters while constructing?

@keicoon

This comment has been minimized.

Copy link
Contributor

@keicoon keicoon commented Oct 28, 2019

Actor_C that be created by uclass is unreal class.
It can't be get more custom parameter by override constructor.
Only way is that use lazy-initialization.

class MyActor extends Actor {
            ctor() {
                console.log('ctor')
            }
            lazy_ctor(...params) {
                console.log('lazy_ctor', this, params)
            }
        }
        let MyActor_C = require('uclass')()(global,MyActor);
        let d = new MyActor_C(GWorld, {Z:100});
        d.lazy_ctor([1,2,3]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.