I’m trying to create a simple presentation, that should be easily accessible to anyone who comes across it regardless of their IT literacy skill level.
I have several objects spaced out with 3D widgets stating their names/properties. These objects are clickable and UE plays a quick camera animation to zoom to the object when clicked.
I also have some menu widgets for navigation which don’t directly relate to any of the clickable objects. These widgets are animated to add and remove them from the screen during navigation.
What I’m trying to do is play the navigation animation to remove the menu from the screen when an object is clicked and the camera animation is played.
Removing from parent, removes the wrong widget, and removing all widgets also removes the 3D ones which I don’t want.
I’ve been looking around at Blueprint Interface tutorials, but there’s nothing quite like this that I’ve seen and I’m having difficulty understanding how to use them - even following tutorials step by step I get different results (i.e. can’t get an ‘Event’ option for the Interface after adding it to the class settings, only a ‘function’ option)
So what it looks like from what I can see is that the Target on New Function 0 is set to be “touched Component”, but it needs to be the widget. I’d need more screenshots to be absolutely sure.
Try putting a printstring between the click event and the outgoing BPI message, and plug your “Touched Component” into the printstring. Then test it. If it says it is indeed bringing the widget as the target, then that’s not it. But I’m betting it’ll say “Cube” or whatever your collision box is named.
So how to I set the target to the widget? I can’t find it when I search, and I’ve tried ‘self’ also.
Edit:
Scratch that I think I figured that bit out.
I’ve created a variable called Animated Widget, and set it’s type to the Animated Widget Blueprint
Then I’ve set that as the target for the BPI message
I know the Play Animation and Button Click work, because of the other 4 ‘on clicked’ events attached to it all work as intended.
It’s the BPI Event that doesn’t appear to be firing. Putting a Print String in didn’t show anything.
Everything after the BPI Message also runs (play level sequence), so it’s not like the ‘On Clicked (Cube)’ get’s stuck and stops processing, it just doesn’t appear to fire/respond.
Is what I’ve done with the variable BPW Animated Widget the correct way to reference the widget as the target?
How did you set the value of that variable. Do a isValid check; it’s probably null. Creating a reference variable does little unless you point it at a valid object. What if you had 3 animated widgets and 3 variables? Which one is which?
Imagine creating a string variable but forgetting to type in the text. You have a variable that could hold text but does not yet.
I created the Variable in the Blueprint and then set it’s type to the specific Widget I wanted to reference.
(I’ve changed the variable name in the image below to differentiate)
Sorry, I’d called them both the same thing originally - do you mean the variable or the widget?
The Variable (that I renamed for the previous post) is created in the Blueprint with the ‘OnClicked (cube)’ event. I then set the type of the variable to the Widget Blueprint that I want the BP Interface to send the message to.
The Widget Blueprint (also called BPW Animated Widget) is a separate Blueprint.
So what is it that I need to put in the target to get the BP Interface to work, and play the animation sequence in the Widget?
The Widget Blueprint (also called BPW Animated Widget) is a separate Blueprint.
So how does this separate Blueprint come to life? Is it spawned, created as a regular widget with script, is it a widget component attached to the actor, is it a part of some other actor that is in the level blueprint perhaps?
So what is it that I need to put in the target to get the BP Interface to work, and play the animation sequence in the Widget?
The target will the instance of the widget. How to get there will be easier if you know where it is - hence the questions above.
If you have 4000 cubes rather than 4, do tell. No one can drag 4 thousand wires around. Or if you have some rules regarding which cubes play which animation, it can also be automated.
And if you have 1 particular mesh that is clickable:
So there’s 13 (I think) cubes that will be required in the end.
The animation they’re playing is to move buttons on and off the screen in the widget.
I don’t want the animation to happen automatically, it needs to happen when the cube is clicked by the user, to change menus within the widget.
It doesn’t all happen in the level blueprint (unless you were saying it needs to), only the spawning of the widget.
The interface message is in the cube blueprint because it needs to happen on click, which also plays a camera sequence.
The above script would work exactly like you’ve described. It would play an anim when the cube is clicked. If you have 13 and that’s too many to connect by hand:
It means we’re Adding to the Viewport more than once. It may cause a memory leak, depends on what’s underneath. Can you show how the widget is created and added? On Begin Play? Perhaps it’s in the loop?
I do have 2 ‘add to viewports’ but it was like this before and not giving the error. Do I not need both?
Edit:
Removing one didn’t change anything - still works and still gets the warning.