Forum rules - please read before posting.

Can't "Add New" within the Scene Manager

Whenever I try to "Add New" (camera, hotspot, trigger, interaction, etc.) anything in a scene, I get the following error which prevents adding new elements to a scene: 

NullReferenceException: Object reference not set to an instance of an object
AC.SceneManager.ListPrefabs () (at Assets/AdventureCreator/Scripts/Managers/SceneManager.cs:758)
AC.SceneManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/SceneManager.cs:334)
AC.AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:128)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

I'm using AC 1.51 and haven't had this issue until a few days ago. The only change I can think of is that I did make a copy of my full project folder (to test latest AC version in original file) and am now using the new copy of the files (because I was having issues with updating AC). But it has 100% of the original files and should be the same. 

Comments

  • I can only see this error occuring if you don't have your AdventureCreator/Prefabs folder fully imported.  Try re-importing AC from the Asset Store.
  • I'm still having this issue. AC 1.54b fully imported. Unity 5.4.1f1 (64-bit). Here's the error message I'm getting:


    NullReferenceException: Object reference not set to an instance of an object
    AC.SceneManager.ClickPrefabButton (ScenePrefab _prefab) (at Assets/AdventureCreator/Scripts/Managers/SceneManager.cs:900)
    AC.SceneManager.ListAllPrefabs (System.String _category) (at Assets/AdventureCreator/Scripts/Managers/SceneManager.cs:864)
    AC.SceneManager.ListPrefabs () (at Assets/AdventureCreator/Scripts/Managers/SceneManager.cs:836)
    AC.SceneManager.ShowGUI () (at Assets/AdventureCreator/Scripts/Managers/SceneManager.cs:338)
    AC.AdventureCreator.OnGUI () (at Assets/AdventureCreator/Scripts/Managers/Editor/AdventureCreator.cs:125)
    System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)



    Also, since I updated unity and AC, the horizontal lines in the menus are all shifted to the left when viewing the preview in the game window. image
  • So that we can discount the possibility of this being due to your project duplicating etc, make a fresh Unity project and install AC alone.  Does it then work?

    The horizontal lines issue is separate and should be posted in a new thread.  It's due to the way Unity changed drawing code on Windows, but I've been unable to pin down exactly which version made the change.  What version of Windows are you using?

    You can correct the issue manually, however, by opening DrawStraightLine.cs and replacing "DrawLineWindows" on line 158 with "DrawLineMac".
  • Changing that line to DrawLineMac worked - sorry for posting multiple issues here! I've been a bit scatterbrained from work overload lately. I'm using Windows 7 64bit. 


    As for the can't "add new" issue - I made a new project and it did work. Any suggestions of how to get my current project working or any ideas of what to check for next? 
  • It sounds like a result of the duplication, then.  Could be a permissions or read/write issue, but I suspect it's more to do with Unity than AC.  Try exporting your game's entire Asset folder as a .unitypackage file, and importing it into your new one.
  • That worked! 

    First I imported the full asset folder (including AC files) but that didn't work. I had to freshly import AC into a blank project first and then import the asset package from the old project without AC.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.