Answer the question
In order to leave comments, you need to log in
How to compare object prefab and object?
There is a prefab (which is a trigger 'ohm) that is passed to the script via a public variable:
public GameObject RedSphere;
An object is created in the script using it:
Instantiate(RedSphere);
The object is spawned, but when compared (in the OnTriggerEnter function , when the body with the attached script touches the object), the condition is not met:
other.gameObject == RedSphere
Why this is happening and how to fix it?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question