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

[BUG] UButton Event Bind failed #64

Closed
KarryCharon opened this issue Mar 27, 2023 · 0 comments
Closed

[BUG] UButton Event Bind failed #64

KarryCharon opened this issue Mar 27, 2023 · 0 comments

Comments

@KarryCharon
Copy link
Contributor

KarryCharon commented Mar 27, 2023

绑定 UButton 的 OnPressed 事件总是失败
平台:
Win11, UE 5.1

在Widget的PreConstruct中 给按钮的OnPressed 添加回调

        [IsOverride]
        public void PreConstruct(Boolean IsDesignTime)
        {
                // btn_About = Unreal.NewObject<UButton>(this, UButton.StaticClass(), "btn_About");
                Console.WriteLine("------1");
                btn_About.OnPressed = new FOnButtonPressedEvent();
                Console.WriteLine("------2");
                btn_About.OnPressed?.Add(f);
                Console.WriteLine("------3");
        }

尝试过 不给 OnPressed new 对应的 事件对象, 以及自己new一个UButton 并 set给 btn_About, 结果一样
Debug模式下可以看到 btn_About.OnPressed为Null对象, set后仍然是空对象

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant