V
V
vari0us2015-11-17 17:43:32
C++ / C#
vari0us, 2015-11-17 17:43:32

Unity3d - buggy tag?

I registered the Cars2 tag in the inspector, it seems that I did everything according to the instructions ...
here is the code

void OnTriggerStay(Collider col)
  {
    float use = Input.GetAxis ("Use");
  
    if (col.isTrigger && col.gameObject.CompareTag("Сars2")) {//Если плеер в тригер-коллайдере с тегом кар
      if (use != 0 ) {//И нажал юз
        //перемещаем его в машину
        //тут типа код перемещения
      
      }
    }
    
  }

When crossing any collider trigger, this is
UnityException: Tag: Сars2 is not defined.
CarUsePlayer.OnTriggerStay (UnityEngine.Collider col) (at Assets/sc1/CarUsePlayer.cs:48)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2015-11-17
@vari0us

Maybe the event fires several times, but the object is no longer there?
Those. player is already in the car...?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question