How to get Pointer of UObject from linked K2Node Pin?

I have been studying for K2Node. And find a question.
屏幕截图 2023-12-05 164615
Like this, there is a K2node,How can I get the pointer for linked Component?
I have tried to get pin->DefualtObject,but find that the DefualtObject of pin is nullpre,when it was linked .Only the pin can choose,like Datatable,its pointer can be valid.
So,How to get Pointer of UObject from linked K2Node Pin?

You have to get the array of input pins then get the object property of index[0] pin.

Or get the default if there are no input pins connected.

Thanks. But it still no work.
I want to make K2node to read property of UObject,and it will show a Dropdown list.
and there is PinFactory code.


And there is effect.
屏幕截图 2023-12-05 191650
We see that the LinkedPin—>DefualtObject was still nullptr,otherwise its name will be add to Namelist.

What you’re asking for doesn’t make sense.

K2Nodes operate at “compile” time. DefaultObject is more like a hard coded value and is only relevant if the pin has a dropdown similar to your AttributeName pin.

When you have something connected to your pin, you’re dealing with a variable which means that it’s a runtime value, not compile time. You only know what it’s value is when the game is running and some other part of the graph has assigned it a value. Even if you’ve given it a default, it doesn’t matter because it might change. The only information that you can work with is the type.

Thank your suggest,I noticed that Blueprint and CPPClass is two things.
Whatever I have set in Blueprint,it is empty before game running.
But I am think about another way to get it.
The property is a DataAsset which has been set and register in an ActorComponent.And
the compoennt is be add to actor.
So,I want to work on Blueprint to find the path point to the DataAsset from Actor.It means I can modify input Component and return a NameList dynamic when editing.
It is no completed,but I am trying.
Thank again.

1 Like

I ran into this exact same problem. Do you have any luck on this?