Hi everyone, I am kind of new to Blueprint but i am really learning hard. Currently I am running into a problem which seems to be simple, maybe i am just trapped in the wrong thought so it would be great if you could clear the fogg in my brain.
So here is the goal i want to archeive:
I want to change the StaticMesh on the BluperintActor via ButtonPressed Event in an UMG Widget, while checking if the overlapping Actor has an interface.
I have set up a Blueprint with only 2 components. One is a Static mesh, which i want to change via UMG widget. The other one is a BoxCollision to check if the overlapping Actor has an Interface associated with, and if so ist draws the widget to the viewport. so far so good, everything works as expected. On overlap of the ThirdPersonCharacter, which has the interface, the widget appears on screen.
Now in the Widget i cast to the ActorBlueprint and simply want to change the mesh, but that seems to be not as simple as i thought, because it does not work as i expected.
I know it is probably silly and absolute newbie-stupid but please help, I have tried casting from any direction. Maybe it is a simple “enable Input thing” where i am not beware of.
What does the note say on the cast node? I’m guessing the cast is failing because the reference is invalid . First check the target reference is valid then do a print string node from cast failed
Based on what you’ve shown, your reference 1m isn’t being set anywhere. You need to tell the widget what instance of 1M_Cube_Chamfer it is that you want to manipulate, otherwise it doesn’t know where to point at. Click on the 1m variable, click Editable and then also ExposeOnSpawn and then parse a reference to the 1m_Cube_Chamfer it when you create the widget.
Hi and thanks for your help. I found a kind of solution. and yes you are right EniGmaa and apoisonedgift, the reference was not valid. My solution was to insert a get all actors of class before casting. the problem on that is that every instance is maniplulated the same way. I am going to check the "parse"solution. Do i need so set up an Eventdispatcher? Ok, i try first… may be i come back on this. Once again Thank you guys!!!
So again - how does the parsing work, I have no idea! Thanks!!!
So as I suggested in the above reply, set the 1m variable to ExposeOnSpawn, then in your blueprint where you Create Tp UI Widget, you will now have an extra input parameter. Take the “Other Actor” from the overlap event and plug that into this (you may need to cast to get the right form of the actor). This basically sets the 1m reference at the time that you spawn the widget.