- Home /
Question by
Ash-Blue · Jul 10, 2014 at 09:50 PM ·
texturetriggerapplicationboxcollider
Texture BoxCollider2D in scene view only
I want to texture a BoxCollider2D in the scene editor view only. As we have several re-usable trigger areas we want to see while editing. My current approach is below. So my question is, "What's the best way to approach shading a BoxCollider2D in the editor only?"
void Awake () {
if (!Application.isPlaying) {
// Add my texture
}
}
Comment
using preprocessors
if UNITY_EDITOR
DoSomeStuff(); #endif
EditorScripting
public class Test : Editor { void OnSceneGUI() //Dont remember if thats the method name { DoSomeStuff(); }
Best Answer
Answer by Ash-Blue · Jul 25, 2014 at 09:06 AM
My current solution is to simply use a sprite renderer and hide it outside of the editor view. Working very well for our team to visually debug levels.