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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Compilation Strange Problem

Discussion in 'Editor & General Support' started by kashiftasneem, Jan 6, 2017.

  1. kashiftasneem

    kashiftasneem

    Joined:
    Aug 24, 2012
    Posts:
    15
    Hello. I have run into a strange problem. Everything was working fine yesterday, today I started my unity project and started getting a nullReferenceException. I debugged it and saw that one of my scripts was showing "The associated script cannot be loaded. Please fix any compile errors and assign a valid script".



    According to my knowledge if this happens code should not compile and console should show the error at the specific line of code but none of this happens. There is no error on console and project is compiling and running but shows nullReferenceException where reference of this script is used.

    This is totally beyond me that how can this happen? I deleted library folder, reinstalled Unity, reimported everything but still this error remains.
     
  2. mikael_juhala

    mikael_juhala

    Joined:
    Mar 9, 2015
    Posts:
    247
    Make sure the script is named exactly the same as the file (ie. LightningBoltScript inside LightningBoltScript.cs). Also make sure it is the only MonoBehaviour in that file.
     
  3. kashiftasneem

    kashiftasneem

    Joined:
    Aug 24, 2012
    Posts:
    15
    I have made sure of both of these things. Actually, this is from a package downloaded from Asset Store. I have contacted the developer. Lets see what he has to say.