Forum rules - please read before posting.

Long error code after compiling

edited May 2015 in Technical Q&A
Oh dear,
I spend most of my dev time playing in "Unity mode" and then once I remember to build, something always breaks *sigh*. It doesn't help that I haven't compiled a build since at least 1.43 so I'm not sure if something changed in AC or it's me. Lesson learned, make a build every day.

This time, I'm getting this error: it seems to have to do with my Apply Resolution custom action, however I'm not sure what could be wrong. I can easily paste all the action's code, if needed.
To note that, before compiling, everything was working fine in Unity.
However, after building, I run the game and it wasn't working at all, I couldn't move, WASD didn't respond nor the cursor shows up. I can only open my inventory and the Esc menu - however, the save option is literally missing (?!? could this have to do with the fact that the save system was changed?). I also tried to change the resolution and it actually works.

The "save" options has disappeared from the menu - but it's actually still there, in the Game Editor. I had also implemented the "screenshot method" that's available on AC's website.
I never had such huge problems before :(

After getting back into Unity, pressing play now leads to this red error coming out, which effectively means that I can't keep working until I get this solved:

NullReferenceException: Object reference not set to an instance of an object
AC.GlobalVariables.GetIntegerValue (Int32 _id) (at Assets/AdventureCreator/Scripts/Static/GlobalVariables.cs:87)
AC.ActionApplyResolution.Run () (at Assets/Trapped/Custom Actions/ActionApplyResolution.cs:38)
AC.ActionList+<RunAction>c__Iterator1.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:199)
UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:165)
AC.ActionList:BeginActionList(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:143)
AC.ActionList:Interact(Int32, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:105)
AC.RuntimeActionList:DownloadActions(ActionListAsset, Conversation, Int32, Boolean, Boolean) (at Assets/AdventureCreator/Scripts/ActionList/RuntimeActionList.cs:76)
AC.AdvGame:RunActionListAsset(ActionListAsset, Conversation, Int32, Boolean, Boolean) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:169)
AC.AdvGame:RunActionListAsset(ActionListAsset) (at Assets/AdventureCreator/Scripts/Static/AdvGame.cs:135)
AC.StateHandler:PlayGlobalOnStart() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:70)
AC.SceneSettings:FindPlayerStart() (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:95)
AC.SceneSettings:Start() (at Assets/AdventureCreator/Scripts/Game engine/SceneSettings.cs:68)

edit: if I press the pause button again and in Unity, the game "resumes" despite the red error, and it does say "Gameplay is blocked"... I can only open and close inventory and Esc menu (save option nowhere to be seen) now there too.

Comments

  • The save button will not be present if gameplay is blocked, because you cannot save during a cutscene.

    The console error is caused by your custom script trying to reference a variable that doesn't exist.  Check that your list of Global Variables contains one with an ID number (to the left of the label in the manager) that matches the ID number you use in your script at line 38.
  • edited May 2015
    Thanks for the fast answer, Chris. At least now I know that the save isn't a problem.
    However, the variable is there! I seem to remember that this was working at least one month ago and I haven't touched a thing... very strange.

    Line 38 is:
    int resolutionSetting = GlobalVariables.GetIntegerValue (1);

    and under the Global Variables, I have
    Screen Resolution - Integer - [var:1] - Initial value: 1 - Link to: Options Data.

    am I missing something?
    Besides, hilariously, if I go into the menu and try to change the resolution, it does work indeed

    edit: I'm going to recheck the resolution tutorial step by step in the meanwhile
  • Backup your project, then recreate the variable by deleting and adding it again.  What platform are you building to?  I've recently been made aware that there's an issue with options-linked Variables on iOS.
  • edited May 2015
    Hey Chris,
    thanks a lot for taking your time to answer on weekends, really. Being a 2 people team only we basically work non-stop all week too so this really helps us.

    I am building for Windows, x86.
    I tried what you suggested, deleting the variable and recreating it. Then, I tried to compile. This time I also checked the Dev Build button.
    No luck, though: it still wont work, the in-game console says "NullreferenceException: Object reference not set to an instance of an object." I guess it's referring to the variable, but I can't grasp why this happens at all. 

    I can send screens of my menu if needed but believe me, the whole resolution thing is done just like in your tutorial, with it starting immediately, with only the Fullscreen yes\no addition we talked a while ago (and yeah, I'm 100% sure it was working)

    Not sure if it's useful - likely not - but I've noticed that if I close Unity and reopen it, when I press play, the game works again. So it happens only after compiling. At least, we can continue working in the meanwhile.
    also, my Apply Resolution is in a "Custom Actions" folder - is this correct\indifferent? It does show up correctly under the "Custom" actions. I'm here full time for anything else you might need to investigate.
  • This is just a hunch, but if the variable exists then the only other explanation I can think of is that it has not yet been created at the time the Action is called.

    Variables are copied from the Variables Manager into a local script when your game begins.  If you're following the tutorial exactly, I'm assuming you're calling the Action in your "ActionList on start" field.  Try moving it into an OnStart cutscene temporarily - that won't be a fix, but it will at least help us know the source of this.
  • That's right, I followed the tutorial so my action was starting on ActinList on start game:
    However, since the "Set Resolution" is an "asset", I'm slightly confused as to how I can move it in the OnStart cutscene: I guess I just had to copy-paste the action into a new cutscene, right?
    All right, so by doing that, the game starts fine compiled and I can change resolution from the menu with no problem.

    Does this help?

    The only weird problem that I had, is that while doing some tests, when I changed to 1280 x 800 And put Fullscreen on, this error came up:

    <RI.Hid> Failed to create device file:
     2 "Couldn't find the specified file" (sorry, this error actually appears in my motherlanguage)

    not sure what this could be. It also did not seem to have any impact at all, actually as I could still change resolutions fine.

    p.s. I have "unfreeze pause menus" checked I noticed, but i can't remember what it does and if it may cause problems.
  • And there's nothing more to the error?

    I mean you should place it in the OnStart cutscene of whatever your first scene is.  Again, this is only a temporary change to determine the source of the problem.
  • edited May 2015
    Sorry, did not want to confuse you. That error shows up only when I keep trying to change the resolution but, yeah, we can ignore it probably.
    There is No error whatsoever if I just use the OnStart cutscene.

    To recap:
    Set Resolution.asset was set to appear in Settings -> "ActionList on start game" like in the tutorial. I took it out from there, created a Cutscene with the same action (Custom -> Engine: Apply Resolution) and put it "On Start" under Scene -> Scene Cutscenes -> On start: in the Game Editor.
    Compiled,
    No error whatsoever appears. Game goes fine. I don't understand what's changed :/

    edit: trying to put the situation as it was before, I notice that not only "gameplay is blocked", but it also says "Current ActionLists running": Set Resolution.
    However, it is as if it remains stuck there (and in the console, there's that error).
  • Thank you.  Leave it in OnStart for now, and I will see about fixing the problem for when it's in your starting asset file.
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.