Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

NullReferenceException: Object reference not set to an instance of an object

Discussion in 'FPS.Sample Game' started by JMasterChief, Nov 12, 2018.

  1. JMasterChief

    JMasterChief

    Joined:
    Dec 15, 2016
    Posts:
    34
    Every code worked, but when I create "Create Game" it sometimes works and it sometimes doesn't. in the terminal, it gives:v NullReferenceException: Object reference not set to an instance of an object. as fail.

    can someone help?
     
    Rananjaya likes this.
  2. Rananjaya

    Rananjaya

    Joined:
    Jul 8, 2018
    Posts:
    1
    same here
    NullReferenceException: Object reference not set to an instance of an. anyone know how to fix this error
     
    Last edited: Nov 22, 2018
  3. AggressiveMastery

    AggressiveMastery

    Joined:
    Nov 19, 2018
    Posts:
    165
    Did you re-import the models? per: https://github.com/Unity-Technologies/FPSSample

    "NOTE: Due to a bug in Unity 2018.3 beta, you have to take the following steps right after the initial import:
    1. Search for t:refab in the Project search field. Then click on the first prefab and shift+click on the last to select them all. Right click and select Reimport.
    2. Search for t:model in the Project search field. Repeat the same steps as for prefabs to reimport them all.
    3. IF you are on a version older than beta 6, you may have had a few crashes during import. In that case you need to find GooRocket and GooRifle in project, right click and select Re-import."
    After you do these steps, and restart unity to reload the project, I believe that clears up the null references.

    You may also need to select the 4.0x .NET framework as well, but it looks like on my load the Player Settings are locked under version control to scripting run-time version .net 4.x, so your should be as well.

    Happy Building,
    -Micah
     
    Rananjaya likes this.