collision with some objects but not others WITH OUT TAGS!!

hi im trying to get a code which says when i collide with some prefab but not others do something. i tried this using tags but it doesn’t work.any code would help. info is good to.thanks :?

Here’s a link where we discussed loading a scene on collision. It demonstrates using collision with tag, to execute code.

http://forum.unity3d.com/viewtopic.php?t=51561&highlight=

Here’s the working code.

   function OnControllerColliderHit(hit: ControllerColliderHit) 
   { 

      if(hit.gameObject.tag == "zoneLoad1") 
      { 
         Application.LoadLevel("myfirst"); 

      } 
    
       
   }

Here’s a template in which I removed the Scene Load, and you can add your code in the function.

   function OnControllerColliderHit(hit: ControllerColliderHit) 
   { 

      if(hit.gameObject.tag == "yourTagHere") 
      { 
       
//        Your code here

      } 
    
       
   }

Jim Cullen

do you know anyway i can do this without tags at all?

Tag everything you are going to interact with and want some action.

Drag the script onto your player.

If the object doesn’t have a tag, the script wont go off.

If you check the linked post, I have a detailed tutorial on implementing collisions with tagged objects.

Jim Cullen