public void GetInteractions(Interactable inter) { var interactionsByType = dictPool.Get(); interactionsByType.Clear(); bool oneMoreRun = true; int iterations = 0; foreach (var i in inter.Options) { var t = i.GetType(); interactionsByType.Add(t, i); } while (inter.Options.Count > 0) { inter.RemoveOption(inter.Options[0]); } while (oneMoreRun) { if (Application.isEditor) { if (iterations++ > 50) { break; } } oneMoreRun = false; foreach (var category in interactionsByCategory.Values) { foreach (var action in category) { var cachedRoot = action.Root; action.Root = inter.gameObject; if (action.Filter()) { var ta = action.GetType(); EventAction interaction = null; if (!interactionsByType.TryGetValue(ta, out interaction)) { interaction = Activator.CreateInstance(action.GetType()) as EventAction; interaction.Meta = action.Meta; interactionsByType.Add(ta, interaction); } inter.AddOption(interaction); } } } } dictPool.Return(interactionsByType); }