I have a Stove and a burger. Around the top of the stove i have a Box component. What i want to happen is when the burger goes on the top of the stove it waits a few seconds and then changes the material of the burger to something else. I setup what i thought would work but its not working. When i cast to MyCharacter instead it works if i jump ontop of the stove but not when i cast to the burger blueprint. Can someone tell me why this is not working.?
does anyone know how to make this work?
If you set the overlap event in your burger blueprint, and make sure that your burger has collision and can overlap with the same collision channel as your trigger box, then it should work. No need to cast or any of that. Just set it up locally, in the burger blueprint.
Thanks! I checked the options and did not have “Create overlap events” checked.
But I still have 1 problem. I want to have the material change once to being cooked. Then 5seconds later have it changed to burnt. But for some reason when its changed to cooked it never changes again. Do you know the reason for this?
Not sure, can you show the blueprint with the full setup?.
Hard to tell (the screenshot’s a bit low res) but it looks like you’re setting the same material in both cases there.
The first Set material sets it to “Brick” (because i have not made a cooked material yet) And the second one sets the material to “Black” Its just a empty material with a costants at a 0.0 value plugged into base color.
Ah, in the general blur ‘Brick’ and ‘Black’ looked the same. Sorry about the red herring.
I don’t actually know why that won’t work. If the first material does actually get set, I see no reason why the second one does not. I’d have to test something similar on my side and see if it works or not.
Are you doing this in your level blueprint?.
No this is done in the Blueprint of the Burger.
Ok i fixed the Material issue. But now i have a new problem. For some reason this only works with 1 burger at a time. Does anyone have an idea how to make this work with any number?. What it does is if i put more then 1 on at a time it gets confused and keeps them the same material. Because i have it so if you take it off the stove before its finished cooking it stops the event. But i have no clue why it would be only working one at a time. Can someone help me figure this out.?
Does anyone know how i can fix this bug?
I’ll see if I can do a local test for this, I just don’t know blueprints well enough to know off hand what’s going wrong. But one thing, you shouldn’t need to Cast because if you have your Burger blueprint, that’s basically the script for that burger and it’s all dealt with in there, locally. You don’t need to cast. You would use a Cast where you want to communicate between two different blueprints.
So with that said, I’m not sure if possibly the cast is the problem. So you’re triggering this event and casting to the burger which may be casting to the others in your scene and doing the same thing. So you need to treat the burger just locally, just apply materials to “Self” or to “Mesh” probably, and not cast to the burger blueprint.
EDIT:- So, here’s my test setup and works perfectly fine. Though I tested it by player touch, you will get the same results by any touch event. So I think where you’re having problems is by casting. So in my components I have a mesh (StaticMesh1) and a collision box (Box1). You can see I have it set so you touch the collision box and then set the material on the mesh directly.
Ok, I only want the burger affected by this. If i do not cast wont that make every mesh that overlaps change material?
Edit: Yeah Like i thought i did it your way and my character overlapped with the burger and it changed. Thats why i had it cast to the grill so that it only happens with that.
I realize that any overlap event will make it fire, but the question is, if you don’t touch it with the player, does it work. Does multiple burgers actually set their correct material, at the correct intervals.
The collision can be dealt with in some different ways. I think setting up a collision channel for the burger is probably the simplest way. So you tell the stove and the burger to overlap the “Burger” channel and ignore everything else. So no need to try and branch or whatever in the blueprint, it simply won’t fire unless it’s the correct channel overlapping.
I’m not sure what you mean. Thats what the cast does, It Makes sure the the two work together and with nothing else. Could you explain more what you mean.? And they still share the same time. So if i put on on the grill it starts the countdown of the delay and if i put another it changes at the same time as the first.
If you don’t get correct behavior with the setup I’ve shown, then you’re doing something I don’t expect, and so I don’t know what’s going on.
Granted, my test sequence is not “complete”, but it should do the basic functionality without problems and the rest can be dealt with accordingly.
So I don’t know if you’re showing your complete setup, if you’re doing something else somewhere, or really exactly how this is created and used in the first place. I can make a setup that works from scratch but not sure how your setup needs to be fixed, without being able to look at it first hand. I think there’s something getting lost in translation with the screenshots and descriptions, I’m not really sure.
The thing is, I just don’t know ultimately what exactly it is you’re doing that causes the problem.
Here is a Video That may explain more.
In this video i show you what happens when i use your way.While having my way disabled. Then i disable yours and active my way. It shows that when i put multiple Burgers on the grill then it stops working.(some times it keeps working and changes every instance of the blueprint.) But one i just do one at a time it works fine. But your way if i get close to it or get it close to another thing with collision it changes every instance of the blueprint. And does not just work with the grill.
I still have not figured out how to fix this.