0

Im getting this Error in this statement Im trying to get image object in Dropzone area all scripts are attached to the editor. I already checked them .I couldnt find problem please help. Error image

     public void CardDetect()
    {
        D = new DropZone();


        List<Image> listofcard = new List<Image>();

for (int i = 0; i<D.transform.childCount - 1; i++)
        {
            if (listofcard != null)
            {
                listofcard.Add(D.transform.GetChild(i).transform.GetComponents<Image>()[i]);

            }

        }

        for(int i = D.transform.childCount - 1; i > 0; i--)
        {
            // this.PlaceholderParent.transform.Find("Pane").GetComponent<Image>().tag = "ileri"
            if (D.transform.GetChild(i).transform.name == "ileriprefab1")
            {
                ileri = true;
            }


            if (D.transform.GetChild(i).transform.name == "sağprefab")
            {

                sağ = true;

            }
            if (D.transform.GetChild(i).transform.name == "solprefab")
            {
                sol = true;
            }

            if (D.transform.GetChild(i).transform.name == "fprefab")
            {

                f = true;
            }




        }

Blockquote Dropzone Script

Melody
  • 1
  • 2
  • im getting error in that statement----->for (int i = 0; i – Melody Jul 17 '18 at 09:02
  • 1
    `DropZone` seems to inherit from `MonoBehaviour`. If that's the case then you shouldn't be using the `new` keyword to create instance of it. I also see the warning from Unity from your screenshot. See the duplicate for what to do. – Programmer Jul 17 '18 at 09:04
  • I try your way bu my Dropzone script also have interface = MonoBehaviour, IDropHandler, IPointerEnterHandler, IPointerExitHandler. but its not work :/ here is what i change ----> { D = GameObject.Find("carddroparea").GetComponent(); – Melody Jul 17 '18 at 09:20
  • You need to ad "Edit"" to the question and post the class. Also post what you've one after reading the duplicate and explain your new issue – Programmer Jul 17 '18 at 09:24
  • its not work same error again ---->D = GameObject.Find("carddroparea").GetComponent(); – Melody Jul 17 '18 at 09:29
  • 1.Edit your question and post the DropZone script. – Programmer Jul 17 '18 at 09:30
  • Stack gave the error "too much code" i shared Dropzone Script İmage – Melody Jul 17 '18 at 09:47

0 Answers0