Class portScanner
Simple Unity helper that scans available serial ports and allows selecting
one from a UI dropdown to force the COM port used by the stimulation script.
Attach this to a separate GameObject and wire the selectPort()
method to a UI event (e.g., button click) to apply the chosen port.
Inheritance
object
Object
Component
Behaviour
MonoBehaviour
portScanner
Namespace: WSS.Unity
Assembly: UnitySubmodule.Docs.dll
Syntax
public class portScanner : MonoBehaviour
Remarks
Usage:
- Place this script on a separate GameObject (not a child of the stimulation object).
- Assign portScanner.stim and portScanner.serialList in the inspector.
- Ensure the stimulation script has
forcePortenabled so the dropdown selection is used.
Enabling this component temporarily disables portScanner.stim while scanning ports so the stimulation wrapper does not hold an outdated connection open during selection.
Methods
selectPort()
Applies the selected COM port to the stimulation script and re-enables it.
Declaration
public void selectPort()
Remarks
If the dropdown contains only the empty placeholder, this method leaves the stimulation
component disabled and does not change its configured port.