public void OnEnable() { legend = (WMG_Legend)target; fields = GetProperties(legend); }
void Start() { // Create legend GameObject legendObj = GameObject.Instantiate(legendPrefab) as GameObject; changeSpriteParent(legendObj, graphBackground.transform.parent.gameObject); legend = legendObj.GetComponent<WMG_Legend>(); legend.theGraph = this; for (int j = 0; j < lineSeries.Count; j++) { if (!activeInHierarchy(lineSeries[j])) continue; WMG_Series theSeries = lineSeries[j].GetComponent<WMG_Series>(); theSeries.createLegendEntry(j); } checkCache(); // Set all cache variables to the current values setCacheFlags(true); // Set all cache change flags to true to update everything on start orientationTypeChanged = false; // Except orientation, since this swaps the orientation theTooltip = this.gameObject.AddComponent<WMG_Graph_Tooltip>(); // Add tooltip script theTooltip.hideFlags = HideFlags.HideInInspector; // Don't show tooltip script theTooltip.theGraph = this; // Set tooltip graph autoAnim = this.gameObject.AddComponent<WMG_Graph_Auto_Anim>(); // Add automatic animations script autoAnim.hideFlags = HideFlags.HideInInspector; // Don't show automatic animations script autoAnim.theGraph = this; // Set automatic animations graph setOriginalPropertyValues(); }