{"id":5176,"date":"2020-02-18T11:50:06","date_gmt":"2020-02-18T09:50:06","guid":{"rendered":"https:\/\/unitycoder.com\/blog\/?p=5176"},"modified":"2020-02-18T11:50:06","modified_gmt":"2020-02-18T09:50:06","slug":"debug-log-show-actual-color-from-color-variable","status":"publish","type":"post","link":"https:\/\/unitycoder.com\/blog\/2020\/02\/18\/debug-log-show-actual-color-from-color-variable\/","title":{"rendered":"Debug.Log: Show actual color from Color variable"},"content":{"rendered":"\n<p>Had to debug what color is the script returning for mouse pixel position, but printing out the value didn&#8217;t really help:<br><code>Debug.Log(col);<\/code><br>Since the output is like this (you don&#8217;t know whats the actual color)<br><code>RGBA(0,349, 0,204, 0,416, 0,000) <\/code><br>Enter Debug.Log with &lt;color>&lt;\/color> and utf8 block:<br><code>Debug.Log(\"&lt;color=#\"+ColorUtility.ToHtmlStringRGB(col)+\"><\/code>\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588<code>&lt;\/color> = \"+col);<\/code><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"333\" height=\"234\" data-attachment-id=\"5177\" data-permalink=\"https:\/\/unitycoder.com\/blog\/2020\/02\/18\/debug-log-show-actual-color-from-color-variable\/image-4-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2020\/02\/image-4.png?fit=333%2C234&amp;ssl=1\" data-orig-size=\"333,234\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2020\/02\/image-4.png?fit=333%2C234&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2020\/02\/image-4.png?resize=333%2C234&#038;ssl=1\" alt=\"\" class=\"wp-image-5177\" srcset=\"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2020\/02\/image-4.png?w=333&amp;ssl=1 333w, https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2020\/02\/image-4.png?resize=300%2C211&amp;ssl=1 300w\" sizes=\"auto, (max-width: 333px) 100vw, 333px\" \/><figcaption>Using Debug.Log with &lt;color> to display color variable value<\/figcaption><\/figure>\n\n\n\n<p>Snippet, if copying from blog is messed up:<br><a href=\"https:\/\/gist.github.com\/unitycoder\/37872953bd27901391ed0b27d4702e9c\">https:\/\/gist.github.com\/unitycoder\/37872953bd27901391ed0b27d4702e9c<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Had to debug what color is the script returning for mouse pixel position, but printing out the value didn&#8217;t really help:Debug.Log(col);Since the output is like this (you don&#8217;t know whats the actual color)RGBA(0,349, 0,204, 0,416, 0,000) Enter Debug.Log with &lt;color>&lt;\/color> and utf8 block:Debug.Log(&#8220;&lt;color=#&#8221;+ColorUtility.ToHtmlStringRGB(col)+&#8221;>\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588&lt;\/color> = &#8220;+col); [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5177,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"Debug.Log: Show actual color from Color variable #UnityTips","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[797],"tags":[79,1156,738,992],"class_list":["post-5176","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips","tag-color","tag-console","tag-debug","tag-log"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/unitycoder.com\/blog\/wp-content\/uploads\/2020\/02\/image-4.png?fit=333%2C234&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p1KTaT-1lu","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/comments?post=5176"}],"version-history":[{"count":1,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5176\/revisions"}],"predecessor-version":[{"id":5178,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/posts\/5176\/revisions\/5178"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media\/5177"}],"wp:attachment":[{"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/media?parent=5176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/categories?post=5176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unitycoder.com\/blog\/wp-json\/wp\/v2\/tags?post=5176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}