npruehs / ue4-rts

Real-time strategy plugin and showcase for Unreal Engine 4.
MIT License
747 stars 151 forks source link

Fog of War not working in packaged builds #109

Closed iliags closed 4 years ago

iliags commented 4 years ago

In RTSFogOfWarActor.cpp the line FVector SizeInWorld = VisionVolume->GetSizeInWorld(); defaults to a zero vector in packaged builds due to loading orders and whatnot which leads to a dividing by zero issue in the line FogOfWarMaterialInstance->SetScalarParameterValue(FName("OneOverWorldSize"), 1.0f / SizeInWorld.X);. This prevents the fog of war from rendering correctly in the 3D world but works properly on the mini-map.

I did a quick and dirty fix in my project by applying a known good default (0.0001) and then using a flag in tick to check again for a non-zero vector. This works for now and there are probably better ways but I'm out of coffee.

npruehs commented 4 years ago

You're right. I recall similar issues from A Year Of Rain. This should be fixed with #88.

npruehs commented 4 years ago

@iliags I'm happy to tell you that the related issue has been fixed, and I could confirm fog of war working in a packaged build :)

Feel free to re-open this issue if your issue persists.

Thanks for your report!