private void AddSlider() { var multiplySliders = (OSCMultiplySliders)target; var layoutTransform = ((Component)_layoutGroupProperty.objectReferenceValue).transform; var resources = OSCEditorUtils.GetStandardResources(); resources.Color = multiplySliders.DefaultColor; var index = _slidersProperty.arraySize; var sliderObject = OSCControls.CreateSlider(resources); sliderObject.name = string.Format("Slider: {0}", index); var slider = sliderObject.GetComponent <OSCSlider>(); slider.MultiplyController = multiplySliders; var sliderRect = sliderObject.GetComponent <RectTransform>(); sliderRect.SetParent(layoutTransform); sliderRect.localScale = Vector3.one; sliderRect.localPosition = Vector3.zero; _slidersProperty.InsertArrayElementAtIndex(index); var element = _slidersProperty.GetArrayElementAtIndex(index); element.objectReferenceValue = sliderObject; }
public static void AddManager(MenuCommand menuCommand) { var gameObject = OSCControls.CreateManager(); Undo.RegisterCreatedObjectUndo(gameObject, "Create OSC Manager"); }