I want to enable gameobject if i drop 2 gameobject in the same place so i create getmousebuttonup but i don't know how to create statement
public class grey : MonoBehaviour { public GameObject[] color;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
if (gameObject.name== "black" && gameObject.name == "white") {
if (Input.GetMouseButtonUp (0)) {
for (int i = 0; i < color.Length; i++)
color [i].SetActive (true);
}
}
}
}
Answer by Cuttlas-U · Sep 25, 2017 at 05:50 PM
hi;
if i got u right i think u want to active an obejct if 2 other objects are at the same position ;
the idea here can be using a trigger or checking the positions;
i can help u with scripts but u put very simple detailes; give me some screen shots of your project or draw for me what u want to make so i can help u better; and i think your script wont work this way ;
i want to drag 2 object . example black and white are dragged in the same position the the hidden object will be activated.. thanks for helping sir.
hi again ; the collision u wrote has some problems ;
first u should use it for 2d like this :
void OnCollisionEnter2D(Collision2D coll)
the one u are using is for 3d ;
then u should not check "IsTrigger" option if u want it to check the collision ; but u can do it with trigger its better i think ;
any way i think checking collision is not a good idea for this ;
tell me did u wrote the drag and drop script ?
how does it work ? i want to do some thing better here , some thing that works well not with collision ;
I saw your problem late here u can send me mail so i can awnser faster :
good luck ;
Your answer
![](https://koobas.hobune.stream/wayback/20220612135608im_/https://answers.unity.com/themes/thub/images/avi.jpg)