{"id":1582,"date":"2019-12-11T15:47:17","date_gmt":"2019-12-11T15:47:17","guid":{"rendered":"https:\/\/docs.sisus.co\/power-inspector\/?p=1582"},"modified":"2021-03-24T17:49:47","modified_gmt":"2021-03-24T17:49:47","slug":"pheader","status":"publish","type":"post","link":"https:\/\/docs.sisus.co\/power-inspector\/attributes\/pheader\/","title":{"rendered":"PHeader"},"content":{"rendered":"<p>Adds a header above the target in the Inspector.<\/p>\n<p>This is just like Unity&#8217;s built-in Header attribute except that it supports targeting of properties and methods in addition to fields.<br \/>\nIt also includes a couple of convenient constructors that make it easier to do some types of headers.<\/p>\n<h2>PHeader(string header)<\/h2>\n<p>Adds the given header text above a field, property or a method in the Inspector.<\/p>\n<h2>PHeader(params string[] headerLines)<\/h2>\n<p>Adds the given header consisting of two or more lines of text above a field, property or a method in the Inspector.<\/p>\n<h2>PHeader(string header, int fontSize)<\/h2>\n<p>Adds the given header text using the specified font size above a field, property or a method in the Inspector.<\/p>\n<h2>PHeader(string header, int fontSize, string color)<\/h2>\n<p>Adds the given header text using the specified font size and color above a field, property or a method in the Inspector.<br \/>\nIf fontSize equals 0, then the default font size is used.<br \/>\nThe color can be provided in HTML format (for example #ff0000ff) or using the in name of the color (for example red).<\/p>\n<h2>Attribute Target<\/h2>\n<p>Field, property, method or indexer.<\/p>\n<h2>Example<\/h2>\n<pre>using UnityEngine;\r\nusing Sisus.Attributes;\r\n\r\npublic class Headers : MonoBehaviour\r\n{\r\n\t[Header(\"Long headers can be shown without information being cut off because word wrapping is supported. \")]\r\n\tpublic bool wordWrappingSupport = true;\r\n\r\n\t[Header(\"You can also use\\nmanual\\nline breaks.\")]\r\n\tpublic bool lineBreakSupport = true;\r\n\r\n\t[Header(\"&lt;size=15&gt;Rich text markup is &lt;color=green&gt;supported&lt;\/color&gt;&lt;\/size&gt;\")]\r\n\tpublic bool richTextSupport = true;\t\r\n\r\n\t[PHeader(\"The PHeader attribute can be used to add headers before properties and methods.\")]\r\n\t[ShowInInspector]\r\n\tpublic bool Property\r\n\t{\r\n\t\tget;\r\n\t\tset;\r\n\t}\r\n}<\/pre>\n<h2>Example Result<\/h2>\n<p><img loading=\"lazy\" class=\"alignnone size-full wp-image-1583\" src=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/2019\/12\/unity-property-header-attribute.png\" alt=\"\" width=\"403\" height=\"251\" srcset=\"https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/12\/unity-property-header-attribute.png 403w, https:\/\/docs.sisus.co\/power-inspector\/wp-content\/uploads\/sites\/2\/2019\/12\/unity-property-header-attribute-300x187.png 300w\" sizes=\"(max-width: 403px) 100vw, 403px\" \/><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adds a header above the target in the Inspector. This is just like Unity&#8217;s built-in Header attribute except that it supports targeting of properties and methods in addition to fields. It also includes a couple of convenient constructors that make it easier to do some types of headers. PHeader(string header) Adds the given header text ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/docs.sisus.co\/power-inspector\/attributes\/pheader\/\" title=\"read more\">Read more<\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[26],"tags":[],"_links":{"self":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/1582"}],"collection":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/comments?post=1582"}],"version-history":[{"count":2,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/1582\/revisions"}],"predecessor-version":[{"id":1835,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/1582\/revisions\/1835"}],"wp:attachment":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/media?parent=1582"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/categories?post=1582"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/tags?post=1582"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}