- Home /
 
               Question by 
               Matthewlet · Aug 20, 2016 at 06:48 AM · 
                meshchangemeshfilterkeyboard input  
              
 
              How to change mesh on button press?
Hi, I'm trying to make a game and I want to make it so when you press a certain button you change from a square to a circle. I've looked up how to do it but I cant find anything that helps me. Can somebody please let me know if they know how to do it? Thank you.
               Comment
              
 
               
              You need to get the $$anonymous$$esh Filter component of the game object and then on button click you need to change mesh of your mesh filter. Something Like :
 $$anonymous$$eshFilter mf;
 
     void Start ()
     {
         mf    = GetComponent<$$anonymous$$eshFilter> ();
     }
     
         void OnButtonClick($$anonymous$$esh m){
                mf.mesh = m;
         }
 
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
               
 
			 
                