Skip to content

Commit

Permalink
fix component generation onEnable bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Stella Cannefax committed Sep 22, 2019
1 parent bea2b9d commit 1c91cab
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 6 additions & 4 deletions Runtime/Scripts/Component/EventComponentMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,23 @@ static void AddShortcutComponentIfAbsent<T>(GameObject go, ResolumeOscShortcut s
{
go.GetComponents(components);
var found = false;
T component = null;
foreach (var c in components)
{
if (c.Shortcut.Input.Path != shortcut.Input.Path)
continue;

c.Shortcut = shortcut;
found = true;
break;
}

if (!found)
component = go.AddComponent<T>();

if(component != null)
{
go.SetActive(false);
var component = go.AddComponent<T>();
component.Shortcut = shortcut;
go.SetActive(true);
}
}

static void AddColorComponentIfAbsent(GameObject go, ColorShortcutGroup group,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,12 @@ public void OnDisable()

protected void Register()
{
//OscRouter.AddCallback(Shortcut.Output.Path, InvokeFromHandle);
OscRouter.AddCallbacks(Shortcut.Output.Path, ReadData, Invoke);
m_Registered = true;
}

protected void UnRegister()
{
//OscRouter.RemoveCallback(Shortcut.Output.Path, InvokeFromHandle);
OscRouter.RemoveCallbacks(Shortcut.Output.Path);
m_Registered = false;
}
Expand Down

0 comments on commit 1c91cab

Please sign in to comment.