This is probably a bone headed question but how would I create an object that draws in the editor but not in the game itself? I want it to have a mesh in the editor so I can place it properly but it needs to be invisible inside the game proper.
I believe you allready know that if you change its tag to editor only in the inspector, it goes away in the build. But you might need it to just have its renderer off…
You might be able to set a new tag, and use some kind of detection similar to browser detection, but for player instead, to define whether a script turns the renderer off or not?
AC
can’t you just use the same method as in the first car tut - for waypoints they have emptys with a waypoint image that’s kept in an “Editor” folder if i recall - they show up in the editor but not in builds.
if you need the object (ie collision mesh), throw a script on it with renderer.enabled = false in your start function. check the script ref for correct syntax.
At SeriousGames we just have our own DrawWireFrameMesh that we call from an OnDrawGizmosSelected. Works fine (is a bit slow, but that’s ok for our case).
Or you could create a Layer called Editor and have it visible in the Scene View but have it not rendered in all of your cameras. Then place all those meshes in that layer. Might be good for your situation, who knows.
Essentially, what I’m building is a teleporter. I have a teleporter mesh that is in the world and I have a teleporter destination object that I place and associate with the original teleporter.
I want the teleporter destination object to be visible in the editor but I don’t want it to be there when I play the game.
Right now I’m using a mesh so I can make it the same size and shape as the player (for accurate positioning), so if this could be done with a mesh it would be great.
This must be possible as I notice that lights and things don’t draw inside of the game…
Can’t you just use an empty game object as the destination object? You’ll see it in the hierarchy, and you’ll see its position in the editor when you click it. But you won’t see it in the game view at all because it is essentially invisible.
Im still not convinced that switching his object tag to “editor only” is not the solution. I might be misreading the question but try it Willem. Then do a build
AC
I have it working now with my “enabled = false” hackery above. I’m moving on to other parts of the project now but if it gets to be painful down the road, I’ll revisit this thread.
Thanks everyone for the responses! This is a great community.
The best solution I have found is to create an Editor Only layer. Then turn off that layer in the cameras culling mask. Then that object will display in the editor but not in game.