What is the type of this Local variable?

You can just click on the ‘return value’ pin and choose ‘promote to variable’, then you get the right kind.

How about this?

What is the type of this Promoted variable by the name Skin Met Ref or how to know the type if you can’t Identify, I need to know the type because I need to declare the variable for C++ Dynamic Material Instance and the int type is not compatible.

Friend I am writing the function in C++, I need to declare the Variable for the function.

//create skin material

SkinRef = GetMesh()->CreateDynamicMaterialInstance(0, Material.Object, NAME_None);

GetMesh()->SetMaterialByName(“Skin”, SkinRef);

That solution only works when after the begin play and not under in editor.
What I want to achieve in C++ is:

My C++ Code:

//this must be in the constructor

auto Material = ConstructorHelpers::FObjectFinder<UMaterial>(TEXT("parrent material path"));
 
void initSkeletalMesh()
{
    
    if (Material.Object == nullptr) return;
 
    //create skin material
    SkinRef = GetMesh()->CreateDynamicMaterialInstance(0, Material.Object, NAME_None);
    
    GetMesh()->SetMaterialByName("Skin", SkinRef);
 
    //set master pose
    SKMShoes->SetMasterPoseComponent(GetMesh());
 
    //attach hair
    SKMHair->AttachTo(GetMesh(),TEXT("Head"), EAttachLocation::KeepWorldPosition, true);
}

I tried using float but still not compatible.

I don’t understand what you mean by this, I don’t see a reference local variable declared for dynamic material instance.

Please post my code back with the fix.

But you’re trying to assign the MID to a float. In the example

the writer is making the type ‘UMaterialInstanceDynamic*’

This statement

339456-screenshot-4.png

is setting a float param in the material after it has been made.

This is it

The local variable is DynMaterial, that’s the material ref.

Then, later, you can adjust a scalar on that material with

339458-screenshot-6.png

Now, that part I’m afraid I don’t know about :-/

The not-compatible error is fixed and the project compiles successfully, but still the hair mesh is not welded with scalp in the editor.
Please review the Problem:

I assume that sort of functionality is available with C++ ( but don’t actually know ), best to post a new question on that.

Ok, But you can explain why using the blueprint is more efficient in this case, I mean when I attach the hairs using blueprint, the hairs is welded with headsocket in editor and in play mode, but with C++ I don’t know why only welded when playing… but in editor not welded.
I can only think about the one thing that from where the BOOL condition comes in the AttachComponentToComponent node, I think this is responsible for this welding.

When I make it false the hairs mesh is detached from the head socket while play game and in editor both.

Ok Friend I will post it now.