multicast/broadcast support
This commit is contained in:
@ -31,9 +31,19 @@ For the example commands to work, create a simple test scene:
|
||||
|
||||
The example includes these simple commands:
|
||||
|
||||
### Standard Commands (Single IP)
|
||||
- **Toggle Cube**: Enables/Disables the TestCube GameObject
|
||||
- **Start Timer**: Starts a 10-second countdown timer
|
||||
- **Reset Scene**: Reloads the current scene
|
||||
- **Rotate Cube**: Rotates the cube at different speeds
|
||||
- **Change Color**: Changes the cube color (red, blue, green)
|
||||
|
||||
### Broadcast Commands
|
||||
- **Broadcast: Toggle All Cubes**: Sends the toggle command to all Unity instances on your network
|
||||
- **Broadcast: Reset All Scenes**: Resets scenes on all Unity instances on your network
|
||||
|
||||
### Multi-IP Commands
|
||||
- **Multi-IP: Start Timers**: Sends the start timer command to multiple specific IP addresses simultaneously
|
||||
|
||||
## UDP Protocol
|
||||
|
||||
@ -55,9 +65,35 @@ You can add your own commands by:
|
||||
1. Adding a new case in the `ProcessCommand` method in `UDPCommandListener.cs`
|
||||
2. Creating a corresponding JSON entry in your project file
|
||||
|
||||
## Broadcast Mode
|
||||
|
||||
Broadcast mode allows you to send UDP packets to all devices on your local network simultaneously. This is useful when you have multiple Unity instances running on different computers.
|
||||
|
||||
### How to Use Broadcast
|
||||
1. In the UnityUDP app, create or edit a package
|
||||
2. Enable the "Broadcast Mode" toggle
|
||||
3. Send the package - it will reach all Unity instances listening on the specified port
|
||||
|
||||
### Network Requirements
|
||||
- All devices must be on the same local network
|
||||
- Firewall must allow UDP broadcast traffic
|
||||
- Unity instances must be listening on the same port
|
||||
|
||||
## Multiple IP Addresses
|
||||
|
||||
You can send the same command to multiple specific IP addresses at once:
|
||||
|
||||
1. In the UnityUDP app, create or edit a package
|
||||
2. Add multiple IP addresses using the "Add IP" button
|
||||
3. All added IPs will receive the packet when you send
|
||||
|
||||
This is useful for targeting specific Unity instances without broadcasting to the entire network.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- **Commands not working**: Check that your firewall allows UDP traffic on the specified port
|
||||
- **Can't connect**: Verify the IP address is correct (use `ipconfig` on Windows or `ifconfig` on Mac/Linux)
|
||||
- **Unity crashes**: Make sure all GameObject names match the ones in the script
|
||||
- **Broadcast not working**: Ensure your firewall allows UDP broadcast (255.255.255.255) and all devices are on the same subnet
|
||||
- **Multi-IP partial failure**: Check network connectivity to each IP address individually
|
||||
|
||||
|
||||
@ -75,6 +75,27 @@
|
||||
"name": "Change Color Green",
|
||||
"data": "{\"command\":\"change_color\",\"value\":\"green\"}",
|
||||
"ipAddress": "127.0.0.1"
|
||||
},
|
||||
{
|
||||
"id": "cmd-013",
|
||||
"name": "Broadcast: Toggle All Cubes",
|
||||
"data": "{\"command\":\"toggle_cube\"}",
|
||||
"ipAddresses": [],
|
||||
"isBroadcast": true
|
||||
},
|
||||
{
|
||||
"id": "cmd-014",
|
||||
"name": "Multi-IP: Start Timers",
|
||||
"data": "{\"command\":\"start_timer\",\"value\":\"10\"}",
|
||||
"ipAddresses": ["127.0.0.1", "192.168.1.100", "192.168.1.101"],
|
||||
"isBroadcast": false
|
||||
},
|
||||
{
|
||||
"id": "cmd-015",
|
||||
"name": "Broadcast: Reset All Scenes",
|
||||
"data": "{\"command\":\"reset_scene\"}",
|
||||
"ipAddresses": [],
|
||||
"isBroadcast": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user