Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug Unity duplicates scripts on the object

Discussion in 'Editor & General Support' started by jordan45134, Feb 28, 2023.

  1. jordan45134

    jordan45134

    Joined:
    Oct 24, 2017
    Posts:
    16
    If you drag the script from the folder to the game object, then it is duplicated. Reinstalling the editor did not help, as did creating a new project. 2021.3.19f1


     
    Tab1bit0 likes this.
  2. fheronax

    fheronax

    Joined:
    May 2, 2020
    Posts:
    13
    i faced the same error
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,719
    The first clue is that the script is named NewBehaviourScript.

    This right away is invalid and indicates that you failed to follow whatever tutorial you are working from.

    If in fact the tutorial maker SHOWS you in the video to leave the name as NewBehaviourScript, immediately LEAVE the tutorial and never watch anything from that person again.

    Slow down, go back and see what the script is actually supposed to be, and do it properly.

    Tutorials and example code are great, but keep this in mind to maximize your success and minimize your frustration:

    How to do tutorials properly, two (2) simple steps to success:

    Step 1. Follow the tutorial and do every single step of the tutorial 100% precisely the way it is shown. Even the slightest deviation (even a single character!) generally ends in disaster. That's how software engineering works. Every step must be taken, every single letter must be spelled, capitalized, punctuated and spaced (or not spaced) properly, literally NOTHING can be omitted or skipped.

    Fortunately this is the easiest part to get right: Be a robot. Don't make any mistakes.
    BE PERFECT IN EVERYTHING YOU DO HERE!!


    If you get any errors, learn how to read the error code and fix your error. Google is your friend here. Do NOT continue until you fix your error. Your error will probably be somewhere near the parenthesis numbers (line and character position) in the file. It is almost CERTAINLY your typo causing the error, so look again and fix it.

    Step 2. Go back and work through every part of the tutorial again, and this time explain it to your doggie. See how I am doing that in my avatar picture? If you have no dog, explain it to your house plant. If you are unable to explain any part of it, STOP. DO NOT PROCEED. Now go learn how that part works. Read the documentation on the functions involved. Go back to the tutorial and try to figure out WHY they did that. This is the part that takes a LOT of time when you are new. It might take days or weeks to work through a single 5-minute tutorial. Stick with it. You will learn.

    Step 2 is the part everybody seems to miss. Without Step 2 you are simply a code-typing monkey and outside of the specific tutorial you did, you will be completely lost. If you want to learn, you MUST do Step 2.

    Of course, all this presupposes no errors in the tutorial. For certain tutorial makers (like Unity, Brackeys, Imphenzia, Sebastian Lague) this is usually the case. For some other less-well-known content creators, this is less true. Read the comments on the video: did anyone have issues like you did? If there's an error, you will NEVER be the first guy to find it.

    Beyond that, Step 3, 4, 5 and 6 become easy because you already understand!
     
  4. jordan45134

    jordan45134

    Joined:
    Oct 24, 2017
    Posts:
    16
    Oh no, this works with any scripts, whatever they are called. I'm an advanced unity user, just decided to migrate from the 2019 version...
     
  5. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,991
  6. jordan45134

    jordan45134

    Joined:
    Oct 24, 2017
    Posts:
    16
    Ahem, they closed the thread, but the bug still remains. Interesting... :|
     
  7. fivechar

    fivechar

    Joined:
    Mar 24, 2022
    Posts:
    1
  8. GediminasR

    GediminasR

    Unity Technologies

    Joined:
    Aug 19, 2021
    Posts:
    53
    Hello,

    Please note that in the Issue Tracker it's shown that 2021.3.20f1 is fixed and not 2021.3.19f1 which is being used. So please update your Unity Editor and the issue should not happen.

    If the newer versions have the issue please create a new bug report and link this forum thread and the Issue Tracker link, so that our developers would better understand what's happening and it's a regression.

    Bug Reporting - Unity QA

    Thank you in advance!
     
  9. luskos

    luskos

    Joined:
    Mar 4, 2013
    Posts:
    48
    At some point it did that with me and then stopped. Try to Reimport the project. I had so many issues that time that I forgot already what the fix was but it stopped on it's own, so I bet it was Reimport All.