public void Initialize(NodeAppBar newParentToolBar, NodeAppBar.ButtonTemplate newTemplate, ButtonIconProfile newCustomProfile) { template = newTemplate; customIconProfile = newCustomProfile; parentToolBar = newParentToolBar; cButton = GetComponent <CompoundButton>(); cButton.MainRenderer.enabled = false; text = GetComponent <CompoundButtonText>(); text.Text = template.Text; icon = GetComponent <CompoundButtonIcon>(); highlightMeshRenderer = cButton.GetComponent <CompoundButtonMesh>().Renderer; if (customIconProfile != null) { icon.Profile = customIconProfile; icon.IconName = string.Empty; } icon.IconName = template.Icon; initialized = true; Hide(); if (newTemplate.EventTarget != null) { // Register the button with its target interactable newTemplate.EventTarget.Registerinteractable(gameObject); } else { // Register the button with the parent app bar newParentToolBar.Registerinteractable(gameObject); } }
private void Start() { objectToBound = this.gameObject; boxInstance = Instantiate(BoundingBoxPrefab) as BoundingBox; boxInstance.Target = objectToBound; boxInstance.FlattenPreference = flattenedAxis; BuildRig(); appBarInstance = Instantiate(appBarPrefab) as NodeAppBar; appBarInstance.BoundingBox = boxInstance; appBarInstance.HoverOffsetZ = appBarHoverOffsetZ; appBarInstance.Node = this.gameObject; boxInstance.IsVisible = false; }