Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - garside

Pages: [1]
1
Other Packages / Fog of War Thread Error
« on: February 26, 2015, 08:51:59 AM »
So using the FoW system, I ran into an issue where instantiating new prefabs with revealers on them would sometimes cause the entire FoW system to break and stop responding.

I managed to trace the issue down to a buffer not having the proper data at the time of updating which caused an error which silently killed the thread.

In the FOWSystem.cs file I made the following changes which seem to have made it resilient to this problem. The try/catch allows the thread to keep working when the instantiating buffer problem happens, and it seems to have kept things alive for me? Posting it here in case anyone else has this issue!

Note, the "Thread is alive" check in the late update function is a last-ditch effort to restart the system if it dies for another reason. It wasn't ever fired once the try/catch was put in the ThreadUpdate method.

  1. @@ -284,6 +284,13 @@ void LateUpdate ()
  2.                 Shader.SetGlobalVector("_FOWParams", p);
  3.                 Shader.SetGlobalTexture("_FOWTex0", mTexture0);
  4.                 Shader.SetGlobalTexture("_FOWTex1", mTexture1);
  5.  
  6.                 if (!mThread.IsAlive)
  7.                 {
  8.                         Debug.LogError("FOWThread Dead; Restarting");
  9.                         mThread = new Thread(ThreadUpdate);
  10.                         mThread.Start();
  11.                 }      
  12.         }
  13.  
  14.         /// <summary>
  15. @@ -300,7 +307,14 @@ void ThreadUpdate ()
  16.                         {
  17.                                 sw.Reset();
  18.                                 sw.Start();
  19.                                 UpdateBuffer();
  20.                                 try
  21.                                 {
  22.                                         UpdateBuffer();
  23.                                 }
  24.                                 catch (System.Exception e)
  25.                                 {
  26.                                         Debug.LogWarning("FOWThreadException: " + e.ToString());
  27.                                 }
  28.                                 sw.Stop();
  29.                                 if (debug) Debug.Log(sw.ElapsedMilliseconds);
  30.                                 mElapsed = 0.001f * (float)sw.ElapsedMilliseconds;
  31.  

2
Other Packages / Fog of War: Custom shaders in editor mode
« on: February 19, 2015, 01:58:48 PM »
So I'm using the super great Fog of War system using the custom shaders, which work great. The only issue I'm running into is when I'm in the editor, the terrain shader and all the individual items which I have the FoW style shader on are completely black.

Is there a way to get them to render as though everything were visible when the editor is open and the application is not playing?


Pages: [1]