- Home /
Collision with renderer.enabled?
Hello guys.
I currently need a code that renders a sprite 'on' when the 2D Player collides with it. Here's my current code:
function Start()
  {
      renderer.enabled = false;
  }
  function Update () 
  {
      if(Input.GetKeyUp("o"))
          renderer.enabled = true;
      if(Input.GetKeyUp("p"))
          renderer.enabled = false;
  }
So essentially what I want is to replace the if(Input.GetKeyUp("o")) part to a OnTriggerEnter2D collider code (so that the sprite renders whenever the Player makes contact with the game object).
How would I go about this? I need some desperate help, thank you!
               Comment
              
 
               
              Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                