public bool Attach(VisualEffect effect = null) { VisualEffect target = effect != null ? effect : Selection.activeGameObject?.GetComponent <VisualEffect>(); if (target != null && m_View.controller?.graph != null && m_AttachedComponent != target) { if (m_AttachedComponent != null) { m_AttachedComponent.playRate = 1; } m_AttachedComponent = target; m_Subtitle.text = m_AttachedComponent.name; m_LastKnownPauseState = !m_AttachedComponent.pause; m_AttachedComponent.playRate = m_LastKnownPlayRate >= 0 ? m_LastKnownPlayRate : 1; UpdatePlayButton(); if (m_UpdateItem == null) { m_UpdateItem = schedule.Execute(Update).Every(100); } else { m_UpdateItem.Resume(); } UpdateEventList(); var debugMode = VFXUIDebug.Modes.None; if (m_DebugUI != null) { debugMode = m_DebugUI.GetDebugMode(); m_DebugUI.Clear(); } m_DebugUI = new VFXUIDebug(m_View); m_DebugUI.SetVisualEffect(m_AttachedComponent); m_DebugUI.SetDebugMode(debugMode, this, true); m_RootElement.SetEnabled(true); m_SubtitleIcon.style.display = DisplayStyle.None; UpdateBoundsRecorder(); UpdateRecordingButton(); RefreshInitializeErrors(); return(true); } return(false); }
public void Attach(VisualEffect effect = null) { VisualEffect target = effect != null ? effect : m_SelectionCandidate; if (target != null) { m_SelectionCandidate = target; // allow reattaching if effet != null; m_AttachedComponent = target; UpdateAttachButton(); m_LastKnownPauseState = !m_AttachedComponent.pause; UpdatePlayButton(); if (m_UpdateItem == null) { m_UpdateItem = schedule.Execute(Update).Every(100); } else { m_UpdateItem.Resume(); } if (m_ComponentContainer.parent == null) { m_ComponentContainerParent.Add(m_ComponentContainer); } UpdateEventList(); m_SelectButton.visible = true; var debugMode = VFXUIDebug.Modes.None; if (m_DebugUI != null) { debugMode = m_DebugUI.GetDebugMode(); m_DebugUI.Clear(); } m_DebugUI = new VFXUIDebug(m_View); m_DebugUI.SetVisualEffect(m_AttachedComponent); m_DebugUI.SetDebugMode(debugMode, this, true); UpdateBoundsRecorder(); UpdateRecordingButton(); RefreshInitializeErrors(); } }