#Operator Can t be applyed
1 messages · Page 1 of 1 (latest)
I want to add Tag2
if(Coll.gameObject.tag != "TAG1");
the if statement needs a body (The brackets)
Coll.gameObject.tag != "TAG1"||Coll.gameObject.tag != "TAG2"
i will try
if (A || B) {
// This is the body
// An if statement cannot have a semicolon
}
and consider using gameObject.CompareTag("XXXX") for performance
Please use .CompareTag() instead.
it returns boolean value so just gameObject.CompareTag("XXX")==false
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.
I'd let them figure out the || operator before diving deeper
Not works for me
What did you try?
||
i think he is just tag=="abcd" || "efgh" so compiler says string cannot convert to bool
No the whole line
Most likely
if(Coll.gameObject.tag != "BulletTag" || Coll.gameObject.tag != "Basket") ;
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.
Why is there a ; at the end
OK
I have to go
Thank you everyone