Skip to content

Commit 1c91cab

Browse files
author
Stella Cannefax
committed
fix component generation onEnable bug
1 parent bea2b9d commit 1c91cab

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Runtime/Scripts/Component/EventComponentMapping.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,23 @@ static void AddShortcutComponentIfAbsent<T>(GameObject go, ResolumeOscShortcut s
144144
{
145145
go.GetComponents(components);
146146
var found = false;
147-
T component = null;
148147
foreach (var c in components)
149148
{
150149
if (c.Shortcut.Input.Path != shortcut.Input.Path)
151150
continue;
152151

152+
c.Shortcut = shortcut;
153153
found = true;
154154
break;
155155
}
156156

157157
if (!found)
158-
component = go.AddComponent<T>();
159-
160-
if(component != null)
158+
{
159+
go.SetActive(false);
160+
var component = go.AddComponent<T>();
161161
component.Shortcut = shortcut;
162+
go.SetActive(true);
163+
}
162164
}
163165

164166
static void AddColorComponentIfAbsent(GameObject go, ColorShortcutGroup group,

Runtime/Scripts/Component/Events/UnityEvent/OscEventHandler.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ public void OnDisable()
4444

4545
protected void Register()
4646
{
47-
//OscRouter.AddCallback(Shortcut.Output.Path, InvokeFromHandle);
4847
OscRouter.AddCallbacks(Shortcut.Output.Path, ReadData, Invoke);
4948
m_Registered = true;
5049
}
5150

5251
protected void UnRegister()
5352
{
54-
//OscRouter.RemoveCallback(Shortcut.Output.Path, InvokeFromHandle);
5553
OscRouter.RemoveCallbacks(Shortcut.Output.Path);
5654
m_Registered = false;
5755
}

0 commit comments

Comments
 (0)