May not destroy component StaticMeshComponent

Hi All,

Newbie here. Having been stuck with a seemingly trivial yet not-seem-so problem :frowning:

For my current project, I need to use cameras with Orthographic view instead of Perspective in order to achieve the ‘top’ ‘left’ ‘right’ ‘back’ view effects which are commonly seen in most 3D modeling software (ue4 has it too, obviously).

On top of it, the project also requires selected object to be highlighted. For most of the video or text tutorial that I could find online, they are mostly deal with the ‘Post Process Material’ which only takes effects with ‘Perspective’ viewing camera. If the camera is reset to ‘Orthographic’, the entire viewport would turn to the one pure color which is also the color set to the highlight.

There is one video tutorial that I found on youtube, it explained how to achieve the ‘highlight’ effect without using the ‘Post Process Material’. Here is the real problem comes in:

the logic of the blueprint that taught by the video is as follows:

add highlight: initiate the static mesh component →add new static mesh component → assign highlight material to the static mesh component

delete highlight: destroy the static mesh component with the ‘highlight material’ assigned.

All two events are written inside one blueprint which are called through Player Character with casting node towards this blueprint.

As I’m trying to adapt these methods inside my project, I got an error message from the ‘output log’ instead of the ‘message log’, saying something like this:

May not destroy component StaticMeshComponent /Game/Maps/UEDPIE_0_Level_1.Level_1:PersistentLevel.Structural_Framing_L3_2_200_400_1109.NODE_AddStaticMeshComponent-8 owned by StaticMeshActor /Game/Maps/UEDPIE_0_Level_1.Level_1:PersistentLevel.Structural_Framing_L3_2_200_400_1109.

From the message it looks like that two owners are exactly the same, I just couldn’t find ways to solve this problem. I have tried using casting actor to static mesh actor, or just spawning methods, but neither worked so far.

Could anybody shine some light on this problem? I know my writing is quite tedious, and if you have read here so far, I am already deeply thankful.

Peter

instead of spawning and destroying try setting visibility true or false and see if that fits your needs. that way you dont have to keep spawning/initiating and destroying objects. is the highlight something in the game that needs to be gone? its not doing any overlaps or hits is it? if its something that is just there for visuals I have a lot more luck just setting the visibilities. all my weapons are inside one character class and we just change the visibility of all of them to false and the one changing to true and then set a Boolean for each weapon the same way. lol it looks like a mess. just a prototype. will do things the right way later by having weapon actor classes and childrens (suffer the childrens lol) when we rebuild the entire project for an actual alpha but hey its working lolololololol

Thanks a lot Damnationist and sincerely apologize for such a late reply…
Visibility…thanks a trillion man, my mind set has been stuck to a single point for so long that it almost consumed the not-so-much intelligence left in me…
Thanks again. The project that is describe in the question has been put on halt for almost a month. As I’m studying your reply, i will put it in use later on this week.
Bow to the master, bow to the master

omg thank you so much. I have been stuck myself here lately. glad to know that I could help.