Have you looked at the blueprint whilst the game is running to see where the flow of logic gets to?
Have you tried removing the if branch and tried just running the set mesh directly from the on clicked event?
I’ve never used that enable input node but from looking at it your not passing anything through to the player controller pin. do u even need that enable input node anyway input is enabled anyway at start-up if its your player controller?
In fact the more I look at it the less sense it makes. Disable it and try without it.
Also have you actually given the render mesh variables a value?
I have looked at the flow while with the blueprint visisble.
The onClickEvent only triggers when I click on the actuall shape of the object, this would mean that the input works, without the Enable Input it won’t react.
I do set the mesh once, In the constructor, The setup is identical to the logic after the “True” branch. Setting the Render Mesh to Mesh 1.
The render mesh itself was set to nothing since it is instantly overriden in the constructor to Mesh 1, but I have tried to change this to a pillar, hat I won’t see it (other then in BP preview) since the mesh is overriden on construction.
I do see the logic reach the Set Static mesh calls and trying to set the Render Mesh to Mesh 2. Mesh 2 being a cylinder instead of a Cone.
The Player Controller is not set to the players controller, but that being said I do get the onClicked and only when I click on that actor.
Where does RenderMesh come from? Shouldn’t you be calling “get mesh” on the static component? If RenderMesh is the name of your component, then that’s a component, not a mesh.
I think a better way to do this would be to keep a counter, or a boolean variable, and switch on that. Don’t worry about what the extisting mesh is; just invert the boolean (set it to NOT itself) and set the new mesh appropriately.
I just wanted a quick way to confirm mesh changing, a proper system would actually be planed more in depth.
It was a misstake mixing up the component with the static mesh. The more you know.
When I do a comparison between the static mesh and get the static mesh from the component it can compare them proparly and understand that they are the same, triggering true in the branch.
That being said, after the mesh have changed, it will no longer recieve input. Since the collision is done against the mesh, I guess it breaks due to the fact that the mesh just changed.
I also guess there is something that needs to be updated, or reset due to this, but I am not sure what that would be.
Tried to add it as a more generic question to answer hub, but there was a server error.
I had similar problem but then I could fix it, I don’t know if I can explain well what I did, but I will do my best.
After the branch, I used the option “destroy component” and then “spawn actor” to get a ‘switchable’ mesh on my project.