- Home /
 
               Question by 
               Sevinator280 · Jan 28, 2015 at 07:21 AM · 
                meshcollision detectionontriggerentermeshcolliderrts  
              
 
              Modify mesh from code without rebuilding it
Good day everyone!
I want to create a mesh from code to make a selection square for an RTS game. My first version had the problem that OnTriggerEnter was called every Frame because I rebuild the whole mesh.
Is there any way to modify a mesh(created from code) in the Update function without rebuilding the whole mesh. To modify the vertices doesn´t work, does it?
Or do you know any other way to select units by a rectangle?
Thanks in advance! :)
               Comment
              
 
               
              Answer by Simeon · Jan 28, 2015 at 05:55 PM
You can change mesh.vertices, just make sure it matches up with mesh.triangles. Another way is to use a canvas, and scale a panel based on your mouse position. Or use the GL class. Just convert the mouse position to a range of (0,1)  
 
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                