/// <summary> /// Sets the provided content as the global active object. /// </summary> /// <param name="content">The content to display.</param> /// <param name="parameters"></param> /// <exception cref="ArgumentNullException">The content cannot be <see langword="null"/>.</exception> /// <typeparam name="T">The typeof the content. Must be default constructable.</typeparam> public static void ShowInInspector <T>(T content, InspectorContentParameters parameters) where T : ContentProvider, new() { if (EqualityComparer <T> .Default.Equals(content, default)) { throw new ArgumentNullException(nameof(content)); } InspectorContent.Show(content, parameters); }
public static InspectorContent Show(ContentProvider provider, InspectorContentParameters parameters) { var dynamicContent = CreateInstance <InspectorContent>(); dynamicContent.SetContent(new SerializableContent { Provider = provider }, parameters); Selection.activeObject = dynamicContent; return(dynamicContent); }
void SetContent(SerializableContent content, InspectorContentParameters parameters) { m_Parameters = parameters; m_Content = content; m_Content.InspectionContext.ApplyInspectorStyling = m_Parameters.ApplyInspectorStyling; m_Content.InspectionContext.UseDefaultMargins = m_Parameters.UseDefaultMargins; m_Content.Root = Root; m_Content.Initialize(); m_Content.Load(); }