“The Object you want to Instantiate is null” But it works, can I ignore the error?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
1
down vote

favorite












This has never happened to me so I'm a bit confused.



GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;


This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.



Can I ignore this error or is there some problem that I'm not seeing?










share|improve this question







New contributor




IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    up vote
    1
    down vote

    favorite












    This has never happened to me so I'm a bit confused.



    GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;


    This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.



    Can I ignore this error or is there some problem that I'm not seeing?










    share|improve this question







    New contributor




    IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      This has never happened to me so I'm a bit confused.



      GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;


      This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.



      Can I ignore this error or is there some problem that I'm not seeing?










      share|improve this question







      New contributor




      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      This has never happened to me so I'm a bit confused.



      GameObject someObject = Instantiate (Resources.Load ("Prefabs/Items/" + someName)) as GameObject;


      This throws an error but the object is actually instantiated and everything works as intended. The error doesn't stop the program no matter how many times I reproduce this.



      Can I ignore this error or is there some problem that I'm not seeing?







      unity c#






      share|improve this question







      New contributor




      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      IGClusterFck

      61




      61




      New contributor




      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      IGClusterFck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          4
          down vote













          If the object is instantiated, then the error is coming from another instance of the script — you might accidentally have a second copy in your scene.



          You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.



          You absolutely should not ignore this error.



          At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.






          share|improve this answer






















            Your Answer





            StackExchange.ifUsing("editor", function ()
            return StackExchange.using("mathjaxEditing", function ()
            StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
            StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["\$", "\$"]]);
            );
            );
            , "mathjax-editing");

            StackExchange.ifUsing("editor", function ()
            StackExchange.using("externalEditor", function ()
            StackExchange.using("snippets", function ()
            StackExchange.snippets.init();
            );
            );
            , "code-snippets");

            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "53"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "",
            contentPolicyHtml: "",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f164973%2fthe-object-you-want-to-instantiate-is-null-but-it-works-can-i-ignore-the-erro%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            4
            down vote













            If the object is instantiated, then the error is coming from another instance of the script — you might accidentally have a second copy in your scene.



            You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.



            You absolutely should not ignore this error.



            At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.






            share|improve this answer


























              up vote
              4
              down vote













              If the object is instantiated, then the error is coming from another instance of the script — you might accidentally have a second copy in your scene.



              You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.



              You absolutely should not ignore this error.



              At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.






              share|improve this answer
























                up vote
                4
                down vote










                up vote
                4
                down vote









                If the object is instantiated, then the error is coming from another instance of the script — you might accidentally have a second copy in your scene.



                You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.



                You absolutely should not ignore this error.



                At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.






                share|improve this answer














                If the object is instantiated, then the error is coming from another instance of the script — you might accidentally have a second copy in your scene.



                You can print out the path to the object on Start - or in a null check just before the offending line - to help track down unwanted scene duplicates.



                You absolutely should not ignore this error.



                At best, it's burning compute cycles unnecessarily. At worst, it's a sign that your game is doing something you don't fully understand, and that can be the root of much bigger problems down the line.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 40 mins ago

























                answered 1 hour ago









                DMGregory♦

                54.1k11100153




                54.1k11100153




















                    IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.












                    IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.











                    IGClusterFck is a new contributor. Be nice, and check out our Code of Conduct.













                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgamedev.stackexchange.com%2fquestions%2f164973%2fthe-object-you-want-to-instantiate-is-null-but-it-works-can-i-ignore-the-erro%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    Long meetings (6-7 hours a day): Being “babysat” by supervisor

                    Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

                    Confectionery