{"id":1594,"date":"2019-12-11T19:07:21","date_gmt":"2019-12-11T19:07:21","guid":{"rendered":"https:\/\/docs.sisus.co\/power-inspector\/?p=1594"},"modified":"2019-12-11T19:07:21","modified_gmt":"2019-12-11T19:07:21","slug":"locktransform","status":"publish","type":"post","link":"https:\/\/docs.sisus.co\/power-inspector\/attributes\/locktransform\/","title":{"rendered":"LockTransform"},"content":{"rendered":"<p>When added before a component class causes the transform component to be locked to default state in the inspector for all GameObjects that contain the component with this attribute.<\/p>\n<p>This means that the <strong>local<\/strong> position and rotation of the transform will always remain at (0, 0, 0), and the local scale will always remain at (1, 1, 1) as long as the GameObject is shown in the inspector.<\/p>\n<p>This does <strong>not<\/strong> prevent the transform from being modified outside of the inspector.<\/p>\n<h2>Attribute Target<\/h2>\n<p>Component class<\/p>\n<h2>Example<\/h2>\n<pre>using UnityEngine;\r\nusing Sisus.Attributes;\r\n\r\n[LockTransform, ExecuteAlways]\r\npublic class TransformLock : MonoBehaviour\r\n{\r\n\t[HelpBox(\"This transform has been locked to prevent it from being modified.\")]\r\n\t[Button]\r\n\tprivate void Unlock()\r\n\t{\r\n\t\tDestroyImmediate(this);\r\n\t}\r\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>When added before a component class causes the transform component to be locked to default state in the inspector for all GameObjects that contain the component with this attribute. This means that the local position and rotation of the transform will always remain at (0, 0, 0), and the local scale will always remain at ..<\/p>\n<div class=\"clear-fix\"><\/div>\n<p><a href=\"https:\/\/docs.sisus.co\/power-inspector\/attributes\/locktransform\/\" 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\/1594"}],"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=1594"}],"version-history":[{"count":1,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/1594\/revisions"}],"predecessor-version":[{"id":1595,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/posts\/1594\/revisions\/1595"}],"wp:attachment":[{"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/media?parent=1594"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/categories?post=1594"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.sisus.co\/power-inspector\/wp-json\/wp\/v2\/tags?post=1594"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}