#My Project on Drop Box
I’ve included lots of documentation on controls and such
NathanLyer/VictoryGameNov8
I provided a setup to easily test
-creating lots of static mesh actors, press F10, then press F2, then drag mouse around pressing CTRL + LMB to spawn objects
-deleting all the objects in world (SHIFT + T)
-in the console you can see the whole list that is being run through each time SHIFT + T is pressed, showing lots and lots of nones, uses the code I’ve posted, an Actor Iteratorloop
Dear Friends at Epic,
I’m sorta in shock at the moment and I been debugging this issue for four hours
so I may not be exactly coherent.
buut
It seems I cannot destroy actors I create, after I spawn them!
I am using the most rigorous destroying method I know of.
void AVictoryGamePlayerController::VDestroy(UObject * ToDestroy)
{
if (!ToDestroy) return;
if (!ToDestroy->IsValidLowLevel()) return;
ClientMessage("DESTROY CALLED ON");
ClientMessage(ToDestroy->GetName());
//~~~~~~~~~~~~~~~~~~
ToDestroy->ConditionalBeginDestroy();
ToDestroy = NULL;
//*** GC ***
GetWorld()->ForceGarbageCollection(true); //full purge
}
I am calling a full purge of the GC after each actor is destroyed!
Specifically, I am destryoing special versions of Static Mesh Actors using ActorIterator
//~~~ Victory Walls ~~~
TActorIterator< AVictoryWall > ActorItrWalls(TheWorld);
while(ActorItrWalls)
{
VDestroy( * ActorItrWalls);
//~~~~~~~~~~
++ActorItrWalls;
}
#Is ActorIterator Keeping Them To Avoid Disturbing It’s Indicies?
I just thought of fact that maybe the actoriterator is preserving them somehow since iterating over a list of actors as they are being destroyed might be confusing to manage.
#Visually and Collision-Wise, the destroyed actors do disappear
The odd thing is
when I run my destroy function
visually, they disappear!
And their collision also goes away after a momentary pause (0.5-1.5 seconds or so)
But if I run my actor iterator over all versions of my static mesh actor present in the world, they are STILL in the world at their same locations
//~~~ Get Total Count ~~~
TActorIterator< AVictoryWall > ActorItrCtr(RV_World);
RV_Int32 = 0;
while(ActorItrCtr)
{
//why getting duplicates after loading and then saving again?!?!!
Optimize("Loaded DuplciatE?");
Optimize(( * ActorItrCtr)->GetName());
Optimize(( * ActorItrCtr)->GetActorLocation().ToString());
RV_Int32++;
++ActorItrCtr;
}
OptInt("Current Wall Count", RV_Int32);
When I run the above code after destroying them all, I get output showing them as still being at their locations, even tho they are no longer visible
#If I Call Destroy Twice, It says None…7 times (they’re still there)
#Proper Way to Destroy Actors During Runtime?
Is there a different series of functions I should be calling to destroy Actors spawned during runtime?
#Summary
I can spawn Static Mesh Actors during runtime
But I cannot delete them even with full purging calls to GC
#No UPROPERTY() References
There are no addtoRoots() or UPROPERTY() references to the created SMA’s, ever
#Stronger than Full Purge of GC?
Whatever ActorIterator is doing, shouldnt a full purge of the GC be more powerful?
Any help would be very much appreciated!
I thought the destroy function I created was as aggressive as I could possibly make it!
Looking forward to hearing from you!
Rama