Skip to content
TheChatArchiveThe Chat Archive
o1-preview-2024-09-12· OpenAIAi2 WildChat-4.8M (AI2)

void UCustomK2Node::PinConnectionListChanged(UEdGraphPin* Pin) {…

  1. User

    void UCustomK2Node::PinConnectionListChanged(UEdGraphPin* Pin) { Super::PinConnectionListChanged(Pin);

    auto z = Cast<UK2Node_VariableGet> (Pin->LinkedTo[0]->GetOwningNode());
    

    } как мне получить то, что внутри z?

  2. Assistant

    To access the information inside z, which is a pointer to a UK2Node_VariableGet, you can use the methods provided by the UK2Node_Variable class (from which UK2Node_VariableGet inherits). Specifically, you can retrieve the name of the variable or its associated property. Here's how you can do it:

    if (z)
    {
        // Get the variable name
        FName VariableName = z->GetVarName();
    
        // Or get the variable property
        FProperty* VariableProperty = z->GetPropertyForVariable();
    
        // You can now use VariableName or VariableProperty as needed
    }
    

    Explanation:

    • GetVarName() returns the FName of the variable that the node represents.
    • GetPropertyForVariable() returns a pointer to the FProperty associated with the variable, which provides more detailed information such as type, metadata, etc.

    Make sure to check that z is not nullptr before accessing its methods to avoid potential crashes.


    By using these methods, you can retrieve and work with the underlying variable information represented by the UK2Node_VariableGet node you have obtained.