I've pinpointed where the issue come from more precisely, but still I have no fix.
Code:
Log: World exists but PersistentLevel doesn't for 32x32_1, most likely caused by reference to world of unloaded level and GC setting reference to NULL while keeping world object
Log:
Log: World 32x32_1.TheWorld is not referenced
Log: Shortest reachability from root to World 32x32_1.TheWorld:
Log: World 32x32_1.TheWorld [target]
Log: Wall Map32x32.TheWorld:PersistentLevel.Wall_0 (ObjectProperty Basalt.Tiles:VisualConfiguration.MIC)
Log:
Log:
Log: World 32x32_1.TheWorld [target]
Wall Map32x32.TheWorld:PersistentLevel.Wall_0 (ObjectProperty Basalt.Tiles:VisualConfiguration.MIC)
The persistents 'cell actors' maintain a struct:
Code:
struct VisualConfiguration
{
var StaticMesh SM;
var Material Mat;
var int neighborConfiguration;
var rotator unrealRotation;
var MaterialInstanceConstant mic;
var bool micInitiated;
structdefaultproperties
{
neighborConfiguration=-1
}
};
var VisualConfiguration VC;
So persistent actors can still updated themself without the meshes from the non persistent worlds. It works pretty good. However the previous mentioned bug is triggered because of the material instance constant in this structure.
When a non persistent mesh actor wake up, it attach its cell actor to itself, calling attach:
Non_persistant_actor::PrebeginPlay call persitent_actor::attachTile(reference to the non persistent actor)
Code:
//TileMesh management
//===============================================
function attachTile(TileMeshActor t)
{
local actor crash;
myTile = t;
t.job = self;
VC.micInitiated=false;
updateTile();
}
function updateTile()
{
local vector translation;
if(myTile==none)
return;
translation.Z=upperLayer?256:0;
myTile.myMesh.SetStaticMesh(VC.SM,true);
myTile.myMesh.SetMaterial(0,VC.Mat);
UpdateMaterialInstance();
myTile.myMesh.SetRotation(VC.unrealRotation);
myTile.myMesh.SetTranslation(translation);
}
function detachTile()
{
}
// Material management
//===============================================
function UpdateMaterialInstance()
{
if(!VC.micInitiated)
InitMaterialInstance();
VC.mic.SetScalarParameterValue('selected',selected?1:0);
}
function InitMaterialInstance()
{
if(myTile!=none){
VC.micInitiated = true;
VC.mic=myTile.myMesh.CreateAndSetMaterialInstanceConstant(0);
}
}
The issue is triggered by the line : VC.mic=myTile.myMesh.CreateAndSetMaterialInstanceC onstant(0);
If I comment this line, my game runs fine with level streaming. But of course, I need it so non persistent actors do not lose their materials setup.
Weirdest fact ever:
If I comment the line, my breakpoints (placed previous to this line) in VS work fine. However if not, I get the game cycling with the error log and my breakpoints are never triggered (While I'm 100% sure the issue come from this line).
Bookmarks