Skip to content

Commit d918bde

Browse files
authored
Merge pull request #24 from Chenxi-Zhang/main
opt ports remove
2 parents 2c590c5 + 3815882 commit d918bde

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

Editor/Scripts/Node/PlayableNode.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private void SyncPorts(out bool portChanged)
265265
// Input ports
266266
var inputCount = isPlayableValid ? Playable.GetInputCount() : 0;
267267
var redundantInputPortCount = InputPorts.Count - inputCount;
268-
for (int i = 0; i < redundantInputPortCount; i++)
268+
for (int i = InputPorts.Count - 1; i >= inputCount; i--)
269269
{
270270
// Port won't change frequently, so there's no PortPool
271271
inputContainer.Remove(InputPorts[i]);
@@ -287,8 +287,7 @@ private void SyncPorts(out bool portChanged)
287287

288288
// Output ports
289289
var outputCount = isPlayableValid ? Playable.GetOutputCount() : 0;
290-
var redundantOutputPortCount = OutputPorts.Count - outputCount;
291-
for (int i = 0; i < redundantOutputPortCount; i++)
290+
for (int i = OutputPorts.Count - 1; i >= outputCount; i--)
292291
{
293292
// Port won't change frequently, so there's no PortPool
294293
outputContainer.Remove(OutputPorts[i]);

0 commit comments

Comments
 (0)