I had some GL code that I decided to temporarily put in a method named Render() before deciding what to do with it. I didn't see it listed in the script reference class member index, so I figured it's safe to use. But when I run the project, this method, in a script attached to an otherwise empty game object, runs and I see the GL drawing. Which is cool - I'd like to keep extra rendering code attached to various objects like this, but is Render a built-in method that I should avoid overriding? Code (csharp): function Render() { GL.Begin(GL.LINES); GL.Color(Color.white); for (var edge in edges) { GL.Vertex(edge.start_vertex); GL.Vertex(edge.end_vertex); } GL.End(); } [/code]
Hm... I don't see any place in Unity where we'd call a Render() method on a script. Are you sure you're not calling that yourself (presumably from some other script)? If you'd put a print("foo") inside the method, you can see the stack trace in unity console.
Good tip - I put in a print("foo") and the console shows it's the first method called in the stack trace. I created a new project from scratch and made a minimal script with just the Render method and a print call, and I attached the script to the main camera, got the same results. I'll send it in via the bug report app. ----UnityEngine.Debug:Internal_Log(String, Object) ----UnityEngine.Debug:Internal_Log(String, Object) ----UnityEngine.Debug:Log(Object) ----UnityEngine.MonoBehaviourrint(Object) ----NewBehaviourScript:Render() (at Assets/NewBehaviourScript.js:6) foo UnityEngine.MonoBehaviourrint(Object) NewBehaviourScript:Render() (at Assets/NewBehaviourScript.js:6) (Filename: Assets/NewBehaviourScript.js Line: 6) Code (csharp): function Update () { } function Render () { print("foo"); }