# Enabling/Disabling things in the editor?

**URL:** <https://forum.defold.com/t/enabling-disabling-things-in-the-editor/74513>\
**Category:** Questions\
**Created:** [October 14, 2023, 4:28am UTC](https://forum.defold.com/t/enabling-disabling-things-in-the-editor/74513 "2023-10-14T04:28:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![distantforest](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/distantforest/32/33570_2.png) [@distantforest](https://forum.defold.com/u/distantforest)\
**Post date:** [October 14, 2023, 4:28am UTC](https://forum.defold.com/t/enabling-disabling-things-in-the-editor/74513/1 "2023-10-14T04:28:32Z")

</div>

Is there a way to enable/disable components and game objects in the editor? Sometimes I’d like to disable things and then reactivate them through code or other means. I know I can enable/disable in code with `msg.post(".", "disable")` but it would be nice to do it in the editor as well

I see that the gui elements has it, but I dont see it for normal game objects/components?

---

<div class="post-metadata">

**Author:** ![britzl](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/britzl/32/23_2.png) [@britzl](https://forum.defold.com/u/britzl)\
**Post date:** [October 14, 2023, 6:39am UTC](https://forum.defold.com/t/enabling-disabling-things-in-the-editor/74513/2 "2023-10-14T06:39:23Z")

</div>

> [@distantforest](#):
>
> I see that the gui elements has it, but I dont see it for normal game objects/components

Correct. We do have a feature request on GitHub to implement this, but it is has not been prioritized yet.

---

<div class="post-metadata">

**Author:** ![distantforest](https://forum-defold.b-cdn.net/user_avatar/forum.defold.com/distantforest/32/33570_2.png) [@distantforest](https://forum.defold.com/u/distantforest)\
**Post date:** [October 14, 2023, 12:24pm UTC](https://forum.defold.com/t/enabling-disabling-things-in-the-editor/74513/3 "2023-10-14T12:24:19Z")

</div>

I created a script as a workaround for now:

 ![image](https://forum-defold-uploads.b-cdn.net/original/3X/4/b/4b17b65a927a7028b4bded5f9fcffff10a23da27.png)

```lua
-- set_enabled.script
-- Enables/Disables component or game object on init or reload
go.property("target_url", msg.url("."))
go.property("enabled", true)

local function set_enabled(self)
	if self.enabled == false then
		msg.post(self.target_url, "disable")
	end
end

function init(self) set_enabled(self) end

function on_reload(self) set_enabled(self) end

```

Just add it to any game object and set any target you want. By default it will affect the current game object.
