Change the prefab tag

Can I change the prefab tag after a gameobject touches it?

if you mean changing all the gameobjects related to the prefab, then yes, you can just press on the prefab in the folder you have put it in the Project.

if you mean about only the Game Object in your scene then still yes, from the Inspector tab at the up.

@oreltubul9 Add this script to the bullet and add a Collider to it (isTrigger must be true). This script will check if the gameObject that collide with the bullet is the Enemy (the enemy must have a Tag called “Enemy” qnd a collider) then will change the enemy’s tag to what you write in the “Tag” variable.
Code:

 using System.Collections;
 using System.Collections.Generic;
 using UnityEngine;
 
 public class WriteHereTheScriptName : MonoBehaviour {
 
     public string EnemyTag = "Enemy"; //Write here the tag that ALL ENEMYS have (in case they haven't tag add "Enemy" to all of them)
     public string Tag = ""; //Write inside the "" the tag that the enemy will change to
 
     void OnTriggerEnter (Collider other){ //This funcion is used to detect when a gameObject collide with us
 
         if (other.gameObject.tag == EnemyTag){
 
             other.gameObject.tag = Tag;
         }
     }
 }

I hope this helps you :slight_smile:

You add that script to the enemy, right? I don’t know why it doesn’t work, I tried that in my computer and it works :confused:
Check if the bullets have a collider and if the enemys have a collider maked has trigger.
Anyways, in my Unity version (2017.3.1f1) there is a bug in wich sometimes the OnTriggerEnter doesn’t work, I solved that adding a Rigidbody (marked as kinematic) to the enemy and bullet. It sometimes makes the OnTriggerEnter works, I don’t know if it is a bug or it isn’t. Anyways I hope this helps you.