I have a prefab that has a collider. This collider serves as an obstacle. The thing is that I want to remove this collider from all objects inside another collider defining the map limits.
This way, objects inside the game area will keep their collider, but those outside the play area get their collider removed, and serve just as decoration.
I can't use the OnTriggerEnter2D as physics are disabled in editor mode. But applying the changes in play mode is no good neither, as changes are not saved.
How can I create an script that checks if a collider is inside another collide in editor mode, so I can remove it if it does?
Or is there any way to create a script that runs on play mode and use the OnTriggerEnter to delete the collider I want, then save the changes for the editor?
Using bouding boxes is no good, as the collider delimiting the play area is an irregular polygon collider.
Any ideas?
[ExecuteInEditMode]
and if you want save changes in editor when stop game mode you can use ScriptableObject. \$\endgroup\$