Can't destroy or hide from c++

Hello everyone :slight_smile:

I’m trying to make my player put an item back in his bag (by destroying or hidding it, it doesn’t matter for now).
I’ve tried to call different functions on it : Destroy(), K2_Destroy(), SetActorHiddenInGame(), SetHiddenInGame() on each components or DestroyComponent()

None of this worked. I’ve checked that my pointer is not null, and that my function is called and it was called in all of my attempts even if I saw no effect.

So I try using a blueprintnativeevent to call hide() or destroy() and put a print after the call to be sure it was called. It was but my actor was still seen by the player. BUT when I changed the blueprintnativeevent from BeginPlay of BP it worked !
So it seems like I use the good function in the good way but as soon as there is c++ involved… it does nothing.

It seems like a weird issue and I have no idea what I could be doing wrong. Does someone have the solution to this ? Or at least encountered the same issue ?

Thanks for your answers :slight_smile:

Hey, if it’s ok, please share the c++ code that belongs to the error. If the Class is not very big, please share the whole cpp and header file. That’s the easiest way to see what is going wrong.

I found that it was due to the fact that I was using TSubclassOf to call my function. When using pointers*, it is working properly.
I don’t totally understand on what the function was called before, but the problem is solved.

Thank you :slight_smile:

I have the same problem. A class I’ve got spawns an actor, and after a while calls the actor’s Destroy()-event. Nothing happens though.