Home Forums Dungeon Master – Support DungeonLauncher.cs – Object reference not set error

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1984
    T.Z
    Participant

    Hi Vincent,

    All going so well now, I decided to hit the play buttons to see how things look from that perspective and i got this error, i am not quite sure what to make of it as the dungeon still seems to generate ok, the dungeon entrance is in the right place (the start room), and the character is moved there all ok.

    With my limit knowledge it seems to be saying that the startRoom is null and that there is no room with a DungeonConnector, yet they are there.

    NullReferenceException: Object reference not set to an instance of an object
    ChivalrousGames.DungeonMaster.DungeonLauncher.LaunchDungeon () (at Assets/ChivalrousGames/DungeonMaster/Tools/Scripts/DungeonLauncher.cs:67)
    ChivalrousGames.DungeonMaster.DungeonLauncher.Start () (at Assets/ChivalrousGames/DungeonMaster/Tools/Scripts/DungeonLauncher.cs:46)

    I have run the dungeon generation tester, all 100 returned good, and I could not see any issues in a Generation Report either.

    • This topic was modified 2 years, 9 months ago by T.Z.
    #1986
    T.Z
    Participant

    Not sure if this is related but intermittently i get the following error on pressing play.

    DungeonGenerationException: Problem with Room Connector Point Forward in Room 0,0,0_Base_Room_OneExit. No selected config or config selected but no connector
    ChivalrousGames.DungeonMaster.Room.DrawRoom (Boolean characterInsideRoom) (at Assets/ChivalrousGames/DungeonMaster/Scripts/Room.cs:1484)
    ChivalrousGames.DungeonMaster.Room.set_Status (RoomStatus value) (at Assets/ChivalrousGames/DungeonMaster/Scripts/Room.cs:240)
    ChivalrousGames.DungeonMaster.RoomTrigger.EnterRoom (ChivalrousGames.DungeonMaster.DungeonCharacter character) (at Assets/ChivalrousGames/DungeonMaster/Scripts/RoomTrigger.cs:89)
    ChivalrousGames.DungeonMaster.RoomTrigger.OnTriggerEnter (UnityEngine.Collider other) (at Assets/ChivalrousGames/DungeonMaster/Scripts/RoomTrigger.cs:53)

    when i set up the preset room, I gave all except forward a wall_empty connector, and the forward one is set to have a room_to_corridor connector, and when i get to the configuration, the forward one only has a choice of “use normal randomization” there is no option to choose the room_to_corridor setting. The wall_empty connector was made how you did it on the tutorial video, the room_to_corridor connector I made using the wizard, so i am now wondering if i should have done it differently.

    #1987
    vchevaliervchevalier
    Keymaster

    About the dungeon launcher error:
    the dungeon launcher script is just a simple example script on how you can launch you game. The error “NullPointerException” usually means that a script tries to use an object that wasn’t supplied. If I look at my DungeonLauncher script at line 67, I have this line of code:
    Debug.LogError ("No room with a filled DungeonConnector with ConnectorType \"" + entranceDungeonConnectorType.name + "\" was found.");
    The only object this line of code is tryng to use is entranceDungeonConnectorType.
    This is a value that should be set on the DungeonLauncher script.
    Have you set this value on your script? The error leads me to believe that this value is empty.

    About the dungeon generation error:
    This error normally shows up when drawing a room on the map. The message says that either the room connector point with direction forward has no config on it, or there is a config but the config contains no connector. Can you send me a screenshot of the preset room forward connector point configuration and the room forward connector point configuration? (expand the configs and config items please.)

    Thanks!

    #1988
    T.Z
    Participant

    Ah yes, I remember assigning that while doing the tutorial now, but then I must have forgotten to reassign this on the redo, thanks for that i went thru all the things i could think of but totally forgot about that object to be honest, I honestly thought it was wanting it in the inspector for the dungeon, again thank you for putting up with a complete newbie 😀

    I have taken a few screenshots i hope these are what you are after, the forward room connector script and one other (all others are configured the same) from the room that is the base of the preset room is on one, and the other image is of the preset room inspector for forward and one other, with the select config open, all except forward are configured the same and have 2 options, Use normal randomisation and the connector i have set up, but the forward one does not show the option i have set on the base room. It never has had an additional option even when creating the preset room initially, hence my thought that i may have setup the connection wrong but i did use the wizard to create it.

    I am going to email you the pics as soon as this is posted, as i don’t have anyway to share them on here.

    #1989
    vchevaliervchevalier
    Keymaster

    Well, I received your screenshots and all seems well for the configurations. Can you send me an updated version of your project so I can debug this? As far as I can see, this should work…

    #1990
    T.Z
    Participant

    oh ok, was it not weird that the forward config only gave me the normal randomisation, instead of the 2 options i had with the other directions?

    will package it up and send it over like last time 😀

    thanks

    #1991
    T.Z
    Participant

    oh and i forgot to say, it does work at least from what i can see, it just spits the error out intermittently.

    #1992
    vchevaliervchevalier
    Keymaster

    Hum, try as a might, I can’t reproduce this particular error… It seems to always work fine for me. I don’t get the intermittent undesired behavior.
    But I think you could try a couple of things that might help make this error disappear. You can think of these elements as “Best Practices”.

    This error occurs on the DrawRoom method of the room (when a room must be drawn on the map). A room is drawn on the map when various events occur, the most common being when a character enters the room. From what I can see, at the start of your game, the character is already in the entrance room, even before it is generated. I think that since the character is in this location, the DrawRoom method might be called too soon, before the dungeon is properly generated and created. The Dungeon Launcher script is already supposed to move your character from a safe position outside the dungeon to the inside of your dungeon when the dungeon is properly generated. So if you moved your character outside of the dungeon generation area, you would be sure that the character enters the dungeon only when it is properly generated. Test this by moving your “Player1Holder” to the following coordinate: -10,0,-10. It should never be in the dungeon area at the start.

    Another thing that could help, I see that there are 5 active rooms in your scene at the moment:
    Base_Open_Room, Base_Corridor_Middle, Base_Room_OneExit, Base_Corridor_Corner and Base_Corridor_End.
    All of these rooms are currently located at the origin (0,0,0) of your scene and are active. I think they are still in your scene because you are working on them, but keep in mind that normally they should not be in the scene at all, they are prefabs (think of them as templates) in your project and they have no use in the scene. Your rooms will always be instanciated by the Dungeon itself. It is possible that since these rooms are active in the scene and in the same area as your character, they cause conflict with the dungeon located right there. I suggest you remove them from the scene when you are done working on them. You can keep them there for the moment of course. But when you hit the play button, it would be best to at least deactivate them.

    Can you give it a try and let me know if that solves the issue?

    Thanks!

    #1993
    T.Z
    Participant

    Moving the character to those coordinates appears to have done the job, i have pressed play at least a dozen times and got no error popping up, which before i would have had it at least 3-4 times in that many attempts. Thank you for that, I will make sure to have my characters outside and have noted about removing the rooms too once done with them. 😀

    My husband says the help and feedback that you give me, is on its own worth the price we paid for your asset. Thanks again 😀

    • This reply was modified 2 years, 9 months ago by T.Z.
    #1995
    vchevaliervchevalier
    Keymaster

    Great! I’m glad this fixed the bug for you. 🙂

    I think I have a great product with the Dungeon Master and I really believe in it. As such, I think it’s my duty to give an excellent level of support. There’s nothing worse than paying for a tool that is supposed to help you and then you realize you just can’t make it work! I’ve been there…

    Anyway, I’m glad that my support is appreciated. And I would feel very honored to see you complete your project and think that there is a little part of me in it. So say hello to your husband for me and I want to thank him for his good words.

    Once again: I wish you the best of luck with your project! 😀

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.