Custom depth not work correctly

Hi, everyone.
I want to get an outline material.
So I create the material follow a tutorial video.
If I set the RenderCustomDepth to true when in the editor, it will work correctly.
But if I want to set the RenderCustomDepth when playing, it is not working correctly.
Please help me.
[Here is my test video][1]