No double connect on startup

parent 8980c0ea
......@@ -6,6 +6,9 @@ using System.Runtime.InteropServices;
using VA;
// Adapter to VA (singleton)
/**
* Drop this file onto any GameObject. Add a VAUConfig script to the same object to control parameters.
* */
public class VAUAdapter : MonoBehaviour
{
public static string Server = "localhost";
......@@ -30,7 +33,6 @@ public class VAUAdapter : MonoBehaviour
if (_VA == null)
{
_VA = new VANet();
Init();
}
return _VA;
}
......@@ -38,31 +40,29 @@ public class VAUAdapter : MonoBehaviour
private static void Init()
{
if (!_VA.IsConnected())
if (!_VA.Connect(Server, Port))
{
if (!_VA.Connect(Server, Port))
{
Debug.LogError("Could not connect to VA server on " + Server + " using port " + Port);
return;
}
Debug.LogError("Could not connect to VA server on " + Server + " using port " + Port);
return;
}
// Add Asset folder as search path for VA (only works if VA is running on same host PC)
if (!_VA.AddSearchPath(Application.dataPath))
Debug.LogError("Could not add application assets folder to VA search path, VA server running on remote host?");
// Add Asset folder as search path for VA (only works if VA is running on same host PC)
if (!_VA.AddSearchPath(Application.dataPath))
Debug.LogError("Could not add application assets folder to VA search path, VA server running on remote host?");
if (AdditionalSearchPath.Length > 0)
{
_VA.AddSearchPath(AdditionalSearchPath);
// ... append more if required.
}
if (AdditionalSearchPath.Length > 0)
{
_VA.AddSearchPath(AdditionalSearchPath);
// ... append more if required.
}
if (ResetOnAwake)
_VA.Reset();
if (ResetOnAwake)
_VA.Reset();
if (DefaultHRIRPath.Length > 0)
_DefaultHRIRID = _VA.CreateDirectivityFromFile(DefaultHRIRPath);
}
if (DefaultHRIRPath.Length > 0)
_DefaultHRIRID = _VA.CreateDirectivityFromFile(DefaultHRIRPath);
}
public static int DefaultHRIRID
......@@ -74,7 +74,7 @@ public class VAUAdapter : MonoBehaviour
}
// Use this for initialization
void Awake()
void Start()
{
if (_VA == null)
_VA = new VANet();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment