// Use this for initialization private void Start() { //noteManager = transform.root.GetComponent<Note_Tracker>(); noteManager = transform.parent.parent.GetComponent <Note_Tracker>(); // if no note manager stop if (noteManager == null) { Debug.Log("No Ref to noteManager on: " + transform.name); return; } // check each child for the value slider foreach (Transform child in transform.GetChild(0)) { // if the name is the same as the categories dropdown || assign it and stop looking if (child.name == ("Dropdown_Types")) { categories = child.GetComponent <Dropdown>(); break; } // if not then log it else { Debug.Log("No Ref to categories/types dropdown on: " + transform.name); return; } }// end of for each child // check each child for the value slider foreach (Transform child in transform.GetChild(0)) { // if the name is the same as the value slider || assign it / assign the value to our variable and stop looking if (child.name == ("Slider_Value_Important")) { valueSlider = child.GetComponent <Slider>(); myValue = valueSlider.value; break; } }// end of for each child // set can drag this to false so we cannot drag the item yet canDragThis = false; // we are not dragging amDragging = false; // set color picker to off colorPickerOpen = false; // we do want to use this note useThisNote = true; // assign main canvas mainCanvas = transform.parent.GetComponent <Canvas>(); // for each option we have in categories (ie gain, pain, jobs...) foreach (string option1 in noteManager.noteCategories) { // create a list to convert the string List <string> SomeName = new List <string>(); // add the list to the string SomeName.Add(option1); // add everything in the list to the options in dropdown categories.AddOptions(SomeName); }// end of for each option } // end of start
// start private void Start() { // get the reference to the script myNoteScript = GetComponent <myNote>(); myNoteTracker = transform.root.GetComponent <Note_Tracker>(); }// end of start