Skip to content

Commit 1d4ac03

Browse files
committed
Made BaseOutlet update entry points virtual.
1 parent 472f893 commit 1d4ac03

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Runtime/Scripts/BaseOutlet.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@ public abstract class ABaseOutlet<TData> : MonoBehaviour
1111
public string StreamType;
1212
public MomentForSampling moment;
1313
public bool IrregularRate = false;
14+
private bool UniqueFromInstanceId = true;
1415

1516
public abstract List<string> ChannelNames { get; }
1617
public virtual int ChannelCount { get { return ChannelNames.Count; } }
1718
public abstract channel_format_t Format { get; }
1819

1920
protected StreamOutlet outlet;
2021
protected TData[] sample;
22+
// A singleton of a TimeSync object can ensure that all pushes that happen on the same moment (update/fixed/late etc)
23+
// on the same frame will have the same timestamp.
2124
private TimeSync timeSync;
2225

2326
// Add an XML element for each channel. The automatic version adds only channel labels. Override to add unit, location, etc.
@@ -41,7 +44,8 @@ protected virtual void Start()
4144
hash.Append(StreamName);
4245
hash.Append(StreamType);
4346
hash.Append(moment.ToString());
44-
hash.Append(gameObject.GetInstanceID());
47+
if (UniqueFromInstanceId)
48+
hash.Append(gameObject.GetInstanceID());
4549
ExtendHash(hash);
4650

4751
double dataRate = IrregularRate ? LSL.LSL.IRREGULAR_RATE : LSLCommon.GetSamplingRateFor(moment);
@@ -63,7 +67,7 @@ protected virtual void ExtendHash(Hash128 hash) { }
6367
protected abstract void pushSample(double timestamp = 0);
6468

6569
// Update is called once per frame
66-
void FixedUpdate()
70+
protected virtual void FixedUpdate()
6771
{
6872
if (moment == MomentForSampling.FixedUpdate && outlet != null)
6973
{
@@ -72,7 +76,7 @@ void FixedUpdate()
7276
}
7377
}
7478

75-
void Update()
79+
protected virtual void Update()
7680
{
7781
if (outlet != null)
7882
{
@@ -91,7 +95,7 @@ void Update()
9195
}
9296
}
9397

94-
void LateUpdate()
98+
protected virtual void LateUpdate()
9599
{
96100
if (moment == MomentForSampling.LateUpdate && outlet != null)
97101
{

0 commit comments

Comments
 (0)