Legacy Interfaces (Deprecated)
Legacy Interface Base Classes
InterfaceBaseClass (Single-threaded)
using UnityEngine;
namespace realvirtual
{
public class MyLegacyInterface : InterfaceBaseClass
{
[Header("Connection Settings")]
public string ServerIP = "192.168.1.100";
public int Port = 502;
private bool isConnected = false;
public override void OpenInterface()
{
try
{
// Connect to external system
ConnectToServer(ServerIP, Port);
isConnected = true;
Debug.Log("Interface connected");
}
catch (System.Exception ex)
{
Debug.LogError($"Connection failed: {ex.Message}");
isConnected = false;
}
}
public override void CloseInterface()
{
try
{
DisconnectFromServer();
isConnected = false;
Debug.Log("Interface disconnected");
}
catch (System.Exception ex)
{
Debug.LogError($"Disconnect error: {ex.Message}");
}
}
public override void CommunicationUpdate()
{
if (!isConnected) return;
try
{
// Read Unity signals and send to external system
var inputValues = ReadInputSignals();
SendToExternalSystem(inputValues);
// Read from external system and update Unity signals
var receivedValues = ReceiveFromExternalSystem();
WriteOutputSignals(receivedValues);
}
catch (System.Exception ex)
{
Debug.LogError($"Communication error: {ex.Message}");
isConnected = false;
}
}
public override bool GetCommunicationState()
{
return isConnected;
}
}
}InterfaceThreadedBaseClass (Multi-threaded)
Legacy Signal Management
Reading Input Signals (Legacy)
Writing Output Signals (Legacy)
Common Issues with Legacy System
Threading Problems
Manual Signal Management
No Automatic Reconnection
Migration Guide to FastInterface
1. Change Base Class
2. Replace Thread Management
3. Use Built-in Signal Management
4. Update Logging
5. Handle Properties Thread-Safely
Legacy Interface Examples
Why FastInterface is Better
Legacy System Issues
FastInterface Solutions
See Also
Last updated