- Home /
 
               Question by 
               vamshiallstar753 · May 04, 2019 at 11:57 AM · 
                transform2d gameplayerplatformerswitch  
              
 
              How To Change Player As Soon as He Take Powerup
i am making a 2d platformer in which player will have diffrent types of powerups as soon as he takes power up he will tranform into differnt player can u pls check codeing andwhat i need to add in middle using System.Collections; using System.Collections.Generic; using UnityEngine;
 public class CarrotScript : MonoBehaviour
 {
     // Start is called before the first frame update
     private void OnTriggerEnter2D(Collider2D collision)
     {
         Destroy(gameObject);
     }
 }
 
               Comment
              
 
               
              Answer by dnzbrn06 · May 05, 2019 at 05:41 PM
use Instantiate after destroying
  public Gameobject player; //player is just a name
 
 private void OnTriggerEnter2D(Collider2D collision)
      {
          Destroy(gameObject);
 Instantiate(player,transform.position,transform.rotation); 
 
      }
sorry my bad it worked that was small unity error I restarted it worked
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                