Download

SMeshWidget - Hardware Instanced Slate Meshes Thread

Is there any way to find out which instance is being hovered by the mouse?

No, these widgets don’t support any kind of interaction like that so you’d have to build a system in yourself.

Yeah thought so :confused: Thanks anyways!

Hi! I confirmed that Nick’s sample works on UE 4.18 by adding the following changes.

MeshWidgetExample.Build.cs (Update to new format from UE 4.16)



public class MeshWidgetExample : ModuleRules
{
    public MeshWidgetExample(ReadOnlyTargetRules Target) : base(Target)
    {
        PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

        PublicDependencyModuleNames.AddRange(new string] { "Core", "CoreUObject", "Engine", "InputCore", "SlateCore", "Slate", "UMG" });
    }
}


MeshWidgetExample.Target.cs (Update to new format from UE 4.16)



public class MeshWidgetExampleTarget : TargetRules
{
    public MeshWidgetExampleTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Game;

        ExtraModuleNames.AddRange( new string] { "MeshWidgetExample" } );
    }
}


MeshWidgetExampleEditor.Target.cs (Update to new format from UE 4.16)



public class MeshWidgetExampleEditorTarget : TargetRules
{
    public MeshWidgetExampleEditorTarget(TargetInfo Target) : base(Target)
    {
        Type = TargetType.Editor;

        ExtraModuleNames.AddRange( new string] { "MeshWidgetExample" } );
    }
}


MeshWidgetExampleCharacter.cpp (Fixed order of include)



#include "MeshWidgetExampleCharacter.h"
#include "MeshWidgetExample.h"
​​​​​​​

MeshWidgetExampleGameMode.cpp (Fixed order of include)



#include "MeshWidgetExampleGameMode.h"
#include "MeshWidgetExample.h"
#include "MeshWidgetExamplePlayerController.h"
#include "MeshWidgetExampleCharacter.h"
​​​​​​​

MeshWidgetExamplePlayerController.cpp (Fixed order of include)



#include "MeshWidgetExamplePlayerController.h"
#include "MeshWidgetExample.h"
#include "AI/Navigation/NavigationSystem.h"
​​​​​​​

ParticleWidget.cpp (Fixed order of include)



#include "ParticleWidget.h"
#include "MeshWidgetExample.h"
#include "Slate/SMeshWidget.h"
#include "Slate/SlateVectorArtInstanceData.h"
​​​​​​​

ParticleWidget (Fixed lack of include)



#include "Slate/SlateVectorArtData.h"
#include "Widget.h"
#include "ParticleWidget.generated.h"
​​​​​​​

Thanks Nick!

Can you post your code? I’m curious to see how you get your healthbar working… I want to do something similar and would be great if you can share your code…

Hi man,
I got your logic, but I have one confusion.
When your player hits the enemy, their health drops so how are you telling the material to update the health bar.



**FSlateVectorArtInstanceData ParticleData;

ParticleData.SetPosition(Some Position);

ParticleData.SetScale(Some Scale);**

**FSlateInstanceBufferUpdate::CommitUpdate(PerInstaceUpdate);**


Are you using above line of code to send update to the material.
And are you sending packed the byte data in the above statement only and then in material your are unpacking.

I got it, actually onPaint is getting called every frame, I just need to put the logic in that function only and it will wok.
Thanks for the wonderful resource.

fingers crossed, I updated the project to 4.25 GitHub - dantreble/MeshWidgetExample: Nick Darnell's example project from https://forums.unrealeng

Hey,I used your code in ue426 and sucessfully send the renderdata to SMeshWidget::OnPaint() but still nothing have been drawn.Do you have any idea where should i check for?

Hey,Darnell**.**I just figure out how to make this work.And It looks like you send position and scale info into vertex attribute which seems to be a bit costly.So is there a reason why use uniform buffer instead?

----edit----
Don’t notice that is a per instance attribute.