Author Topic: Physics Layers are incorrectly set in build  (Read 343 times)

DamianT

  • Newbie
  • *
  • Posts: 6
    • View Profile
Physics Layers are incorrectly set in build
« on: October 08, 2018, 04:39:18 AM »
I recently updated my project to Unity 2018.2.8f1 and updated to SUIMONO  2.1.6.
I have set the option "Set Automatic Layers" to false, which is fine for working in the editor.

However, when I do a build and run the generated EXE file the layers are being modified when they shouldn't. 
In my case this manifests as the player falling through the ground.

The problem seems to be caused the code block below from the SuimonoModule class
Code: [Select]

if (!autoSetLayers){
    //if (layerTP.stringValue == "Suimono_Water") layerWaterNum = t;
    //if (layerTP.stringValue == "Suimono_Depth") layerDepthNum = t;
    //if (layerTP.stringValue == "Suimono_Screen") layerScreenFXNum = t;

    layerWaterNum = LayerMask.NameToLayer("Suimono_Water");
    layerDepthNum = LayerMask.NameToLayer("Suimono_Depth");
    layerScreenFXNum = LayerMask.NameToLayer("Suimono_Screen");
}

It appears that this should be outside the #if UNITY_EDITOR region.  I have made this change to the code and it seems to solve the problem.

Chingwa

  • Administrator
  • Hero Member
  • *****
  • Posts: 1609
    • View Profile
    • Tanuki Digital
Re: Physics Layers are incorrectly set in build
« Reply #1 on: October 12, 2018, 08:34:18 AM »
Hi Damian.  Thanks for the heads up.  I've been away the past couple weeks and have not been able to answer here, but I will take a look at this code and your suggestion when I return this weekend.