- Home /
Question by
PedroCoriAG · Dec 06, 2018 at 11:21 PM ·
c#inspectoreditor-scriptinglayers
How to add a component to a GameObject when its layer is changed in the inspector
I'm trying to write an editor script that will detect when the layer field of a GameObject is changed in the Inspector. Then, depending on the selected layer, it should add a specific Component to that GameObject. Is there any way to do this? I haven't been able to find how to detect the layer change in the documentation about cusom inspectors and editor scripting.
Comment