Problem with call SetStaticMesh on component, in Blueprint
I have a problem with using function SetStaticMesh in Blueprint. Here is the situation:
1) I have a car actor with 4 wheels as its components (car body + 4 wheels.) Wheels are called WheelA, WheelB, WheelC, WheelD. Wheels ARE NOT instanced static mesh, but just a StaticMeshComponent. All of these wheels have a model BlackWheel.uasset.
2) Somewhere in my Blueprints I'm calling SetStaticMesh on one (or all) of car's wheels to change them to red ones (set up a RedWheel.uasset model.) Like on picture below.
3) It works fine - wheel model is changed I can see it during test gameplay.
4) BUT when I'm returning to Viewport-Perspective in Unreal Engine, - what I see is that all of car wheels are RedWheel.uasset for now! This looks like engine remembers that new RedWheel were set via Blueprint and now displays it in Viewport. IN GAME: there is still BlackWheel - and everything is works fine, but RedWheel is displayed in Viewport - it's really annoying, cos' if car has black wheels, I want them to be black, not red! ALSO, if click on wheel in Viewport and look into Details->Static Mesh section, there is still BlackWheel asset is selected, despite that RedWheel is displayed in Viewport screen!
Is this some kind of a bug? Or there is some kind of cache in Unreal Editor which I can clear to reset actors to their default state?
P.S. There is the same problem with DestroyComponent func. When it called via Blueprint on some component, this component is no longer shown in Viewport of actor, but you can still see its name in components list; when clicking on it's name, it's highlighted in viewport but no model is displayed on screen (only 3 arrows, RGB.)
It looks like editor remembers actions that has happened to component in blueprints! Editor restart doesn't helps - changes are still visible in Viewport.
Thanks for any help with this annoying problem.
Where are you calling the SetStaticMesh function in your blueprint?
A quick solution to this could also just be in your construction script to call SetStaticMesh and set it to the black wheels. That way whenever they are initially created, the wheels will be black.
Then in a function or somewhere later (like pressing a button), call the code you have above to change it to the red wheels.
If that's already what you are doing though, that definitely sounds like a bug.
answered May 03 '16 at 02:51 PM
No matter where - this all gives the same result. In current scenario SetStaticMesh is called NOT in ConstructionScript.
They are already initially black, even if they're red in editor's viewport. I mean this kind like an editor bug - incorrect models are appears ONLY in editor's viewport, not in test gameplay.
What should I do in this case? Can I report somewhere to UE developers team?
answered May 03 '16 at 03:08 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here