#Operator Can t be applyed

1 messages · Page 1 of 1 (latest)

covert gyro
#

A || B

#

if(A || B) { //Your code }

oak forge
#

I want to add Tag2

if(Coll.gameObject.tag != "TAG1");

covert gyro
#

the if statement needs a body (The brackets)

ember ferry
#

Coll.gameObject.tag != "TAG1"||Coll.gameObject.tag != "TAG2"

oak forge
#

i will try

covert gyro
#
if (A || B) {
  // This is the body
  // An if statement cannot have a semicolon
}
ember ferry
#

and consider using gameObject.CompareTag("XXXX") for performance

mystic grotto
oak forge
#

ok

#

I will try

ember ferry
#

it returns boolean value so just gameObject.CompareTag("XXX")==false

mystic grotto
#

This seems fishy to check different tag types. What are you trying to do here? There's several solution that can help solve your problems, but would like to know more context to your story to provide you a better solution.

quick pewter
#

I'd let them figure out the || operator before diving deeper

oak forge
quick pewter
oak forge
#

||

ember ferry
#

i think he is just tag=="abcd" || "efgh" so compiler says string cannot convert to bool

quick pewter
oak forge
#

if(Coll.gameObject.tag != "BulletTag" || Coll.gameObject.tag != "Basket") ;

mystic grotto
#

The logic inside OnTriggerEnter seems confusing and could be simplify with a advance code material, using composition. Such as ITouch or IInteract interface.

#

Then your other class would handle when it interact with this object.

quick pewter
oak forge
#

OK

I have to go

Thank you everyone