Skip to content

Commit a6ed395

Browse files
committed
[BUGFIX] in the editor, go to Edit -> Project Settings -> Player. The inspector pane will now change to show the player settings. Look for the option that says "Run In Background" and check it!
1 parent 3f73416 commit a6ed395

File tree

6 files changed

+57
-66
lines changed

6 files changed

+57
-66
lines changed
Binary file not shown.

Multi Node Rendering/Assets/Scripts/NavigateCamera.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void OnEnable()
5555

5656
void Update()
5757
{
58-
if (!TextureNetworkManager.Instance.IsServer)
58+
if ( TextureNetworkManager.Instance == null || !TextureNetworkManager.Instance.IsServer)
5959
return;
6060

6161
deltaTime = Time.realtimeSinceStartup - lastUpdateTime;

Multi Node Rendering/Assets/Scripts/TextureNetworkManager.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ void Start () {
9797

9898
void OnGUI()
9999
{
100-
GUI.Box(new Rect(5, 5, 450, 450), "window");
101100
if (!_isStarted)
102101
{
103102
m_ip = GUI.TextField(new Rect(10, 10, 250, 30), m_ip, 25);
@@ -126,7 +125,7 @@ void Update ()
126125
if (!_isStarted)
127126
return;
128127

129-
ReceiveNetworkEvents();
128+
StartCoroutine("ReceiveNetworkEvents");
130129
}
131130

132131
public void OnRaycasterParameterChanged(int pass, float opacity)
@@ -219,7 +218,7 @@ private void SendMessageToClient(MessageBase msg, short msgType, int clientConne
219218
SendDataToClient(clientConnectionId, ref data);
220219
}
221220

222-
private void ReceiveNetworkEvents()
221+
IEnumerator ReceiveNetworkEvents()
223222
{
224223
int recHostId;
225224
int connectionId;
@@ -264,41 +263,42 @@ private void ReceiveNetworkEvents()
264263
case NetworkEventType.DisconnectEvent:
265264
{
266265
if (!_isServer)
267-
OnClientDisconnect(recHostId, connectionId);
268-
else
269266
OnServerDisconnect(recHostId, connectionId);
267+
else
268+
OnClientDisconnect(recHostId, connectionId);
270269
break;
271270
}
272271
}
272+
273+
yield return null;
273274
}
274275
/// <summary>
275276
/// Called on the client that the server disconnected
276277
/// </summary>
277278
/// <param name="recHostId">the id of the host this client connected to</param>
278279
/// <param name="connectionId">the id of the connection</param>
279-
private void OnClientDisconnect(int recHostId, int connectionId)
280+
private void OnServerDisconnect(int recHostId, int connectionId)
280281
{
281282
if (recHostId != m_HostId || connectionId != m_ClientConnectionId)
282283
Debug.LogError(String.Format("Error: Client Connection {0} to Host {1} is invalid!", recHostId, connectionId));
283284

284285
Debug.Log(String.Format("DisConnect from host {0} connection {1}", recHostId, connectionId));
285-
286-
OnClientsChanged();
287286
}
288287

289288
/// <summary>
290289
/// Called on the server that a client disconnected
291290
/// </summary>
292291
/// <param name="recHostId">the id of this host</param>
293292
/// <param name="connectionId">the id of the connection</param>
294-
private void OnServerDisconnect(int recHostId, int connectionId)
293+
private void OnClientDisconnect(int recHostId, int connectionId)
295294
{
296295
if (recHostId != m_HostId || m_RendererClientIds.Contains(connectionId) == false)
297296
Debug.LogError(String.Format("Error: Client Connection {0} to Host {1} is invalid!", recHostId, connectionId));
298297

299298
Debug.Log(String.Format("DisConnect from host {0} connection {1}", recHostId, connectionId));
300299

301300
m_RendererClientIds.Remove(connectionId);
301+
OnClientsChanged();
302302
}
303303

304304
/// <summary>

Multi Node Rendering/Assets/Scripts/TileRaycaster.cs

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -99,61 +99,48 @@ public Texture2D GetRenderedImage()
9999
return renderedImage;
100100
}
101101

102-
103-
/// <summary>
104-
///
105-
/// </summary>
106-
private void OnPostRender()
107-
{
108-
if (stateChanged)
109-
{
110-
RenderTile();
111-
stateChanged = false;
112-
}
113-
}
114-
115-
private void OnRenderImage(RenderTexture src, RenderTexture dest)
116-
{
117-
if (tile != null)
118-
{
119-
Graphics.SetRenderTarget(dest);
120-
GL.Clear(true, true, Color.black);
121-
122-
Vector2 tileIndex = tile.tileIndex;
123-
Vector2 numTiles = tile.numTiles;
124-
Texture2D image = renderedImage;
125-
126-
texturedQuadMaterial.SetTexture("_MainTex", image);
127-
texturedQuadMaterial.SetPass(0);
128-
129-
// Scale viewport rect to the tile position
130-
float sl = 1.0f - (2.0f * tileIndex.x / numTiles.x);
131-
float sr = -(sl - 2.0f / numTiles.x);
132-
float sb = 1.0f - (2.0f * tileIndex.y / numTiles.y);
133-
float st = -(sb - 2.0f / numTiles.y);
134-
135-
float left = -1 * sl;
136-
float right = 1 * sr;
137-
float bottom = -1 * sb;
138-
float top = 1 * st;
139-
140-
GL.Begin(GL.QUADS);
141-
{
142-
GL.TexCoord2(0.0f, 0.0f);
143-
GL.Vertex3(left, bottom, 0.0f);
144-
145-
GL.TexCoord2(1.0f, 0.0f);
146-
GL.Vertex3(right, bottom, 0.0f);
147-
148-
GL.TexCoord2(1.0f, 1.0f);
149-
GL.Vertex3(right, top, 0.0f);
150-
151-
GL.TexCoord2(0.0f, 1.0f);
152-
GL.Vertex3(left, top, 0.0f);
153-
}
154-
GL.End();
155-
}
156-
}
102+
// private void OnRenderImage(RenderTexture src, RenderTexture dest)
103+
// {
104+
// if (tile != null)
105+
// {
106+
// Graphics.SetRenderTarget(dest);
107+
// GL.Clear(true, true, Color.black);
108+
//
109+
// Vector2 tileIndex = tile.tileIndex;
110+
// Vector2 numTiles = tile.numTiles;
111+
// Texture2D image = renderedImage;
112+
//
113+
// texturedQuadMaterial.SetTexture("_MainTex", image);
114+
// texturedQuadMaterial.SetPass(0);
115+
//
116+
// // Scale viewport rect to the tile position
117+
// float sl = 1.0f - (2.0f * tileIndex.x / numTiles.x);
118+
// float sr = -(sl - 2.0f / numTiles.x);
119+
// float sb = 1.0f - (2.0f * tileIndex.y / numTiles.y);
120+
// float st = -(sb - 2.0f / numTiles.y);
121+
//
122+
// float left = -1 * sl;
123+
// float right = 1 * sr;
124+
// float bottom = -1 * sb;
125+
// float top = 1 * st;
126+
//
127+
// GL.Begin(GL.QUADS);
128+
// {
129+
// GL.TexCoord2(0.0f, 0.0f);
130+
// GL.Vertex3(left, bottom, 0.0f);
131+
//
132+
// GL.TexCoord2(1.0f, 0.0f);
133+
// GL.Vertex3(right, bottom, 0.0f);
134+
//
135+
// GL.TexCoord2(1.0f, 1.0f);
136+
// GL.Vertex3(right, top, 0.0f);
137+
//
138+
// GL.TexCoord2(0.0f, 1.0f);
139+
// GL.Vertex3(left, top, 0.0f);
140+
// }
141+
// GL.End();
142+
// }
143+
// }
157144

158145
/// <summary>
159146
///
@@ -217,7 +204,11 @@ public void RenderTile()
217204

218205
void Update()
219206
{
220-
//RenderTile();
207+
if (stateChanged)
208+
{
209+
RenderTile();
210+
stateChanged = false;
211+
}
221212
}
222213

223214
/// <summary>
Binary file not shown.

0 commit comments

Comments
 (0)