- Home /
Line Renderer is not being updated in the Game window
Hey folks,
Please give me a suggestion of what might be wrong.. I have created many different vectors (light, normal, tangent, binormal, view) for each vertex. The problem is that if I play my scene, in the editor everything works correct, however, in the game-view I don't see my vectors being updated. Here is a link to the video: http://youtu.be/UmkABJDkOCk Thank you!
I think it just looks like they were not updated. In the Editor window you're watching the scene from a static point of view, but in the game you're rotating the camera around the object. For the game cam everything seems to be static, because everything is calculated upon it. The editor cam is seeing those changes. I can't say which vectors you mean exactly, but for the view vectors for example, if you view the cube from the side in game view and choose a top down in the editor, I bet they all point towards the camera in parallel.
Hi, my view (cyan) vector points to the camera direction (not position), light (yellow) vectors point in the direction of my directional light, white - half vectors (light + view) point half way between light and view. the rest are static normal, tangent and binormal. I am interested in the vectors that are being updated in the editor view (half vector specially) and not in the cam view.
How about adding [ExecuteInEdit$$anonymous$$ode] to the classes rendering your vector Gizmos and referencing Camera.current to access the Editor Camera?
This might also be interesting as there's a lot going on customising the editor window: http://code.tutsplus.com/tutorials/how-to-add-your-own-tools-to-unitys-editor--active-10047
Thanks for the juicy tip, I always wanted to do something with editor and related stuff, however, I don't yet have enough knowledge about it... Never used what you have suggested. Could you please give me more information about camera.current.. ?
I am not as good myself. Since I don't know how you calculate your vector gizmos I can't really say anything about this. All I know is, that when not in play mode an setting the Attribute [ExecuteInEdit$$anonymous$$ode] to all the classes that render the gizmos, Camera.current should return the actual Editor camera in their Update()s , not the game view camera. You should then be able to base your gizmos on its values. I don't think I have any more knowledge on that matter myself, sorry.
Answer by hexagonius · Feb 11, 2015 at 07:22 PM
Ok, here it goes (hopefully):
Put [ExecuteInEditMode] right above the class declaration above line 7 in ShowVectors.cs Replace every Camera.main. with Camera.current.
If I am correct that should show the linerenderers without pressing play AND use the view vectors of the editor camera.
Hello, Unfortunately it didn't help, ins$$anonymous$$d, it completely messed everything up. Firstly, when I have changed camera.main onto camera.current, I got null-ref-ex at the point of the fist swapped camera code (probably all other places in code would give me the same). Secondly, compiler started to yell about leaking meshes, that I have to use shared$$anonymous$$esh ins$$anonymous$$d of just $$anonymous$$esh at the line where I reference $$anonymous$$eshFilter component .mesh. And lastly, some messed up lines appeared on the screen that didn't make any sense. Sadly enough it didn't work out. I suspect I could have not done something additionally maybe... I don't know. But thanks anyway, I'll be searching for solution further!
Hey, I have noticed something. If I disable CameraOrbit script attached to my cam, and if I rotate my cam manually by its' gizmo, the vectors DO follow cam's rotation in real-time trough the camera view. It seems that this script interferes in some way...
Your answer

Follow this Question
Related Questions
change the length of the vector 1 Answer
Can relative velocity be calculated from relative direction vector 3 Answers
MoveTowards problem 1 Answer
vertices in current camera view 1 Answer