Search Unity

  1. Get all the Unite Berlin 2018 news on the blog.
    Dismiss Notice
  2. Unity 2018.2 has arrived! Read about it here.
    Dismiss Notice
  3. Improve your Unity skills with a certified instructor in a private, interactive classroom. Learn more.
    Dismiss Notice
  4. ARCore is out of developer preview! Read about it here.
    Dismiss Notice
  5. Magic Leap’s Lumin SDK Technical Preview for Unity lets you get started creating content for Magic Leap One™. Find more information on our blog!
    Dismiss Notice
  6. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

2D Roguelike: Q&A

Discussion in 'Community Learning & Teaching' started by Matthew-Schell, Feb 10, 2015.

  1. AlfredvanRaal

    AlfredvanRaal

    Joined:
    Feb 27, 2017
    Posts:
    5
     
  2. gamemaster0007

    gamemaster0007

    Joined:
    Apr 30, 2018
    Posts:
    3
    i fixed it so now I can load as many levels as I want, but they are all level one, and my food count is reset. what is wrong now
     
  3. melvinluismendoza

    melvinluismendoza

    Joined:
    Oct 31, 2016
    Posts:
    3
    Hi!

    Doing this tutorial in Unity 2018.1.2f1 and my problem is... weird.

    When I start the game, two instances of Board are created, and the game begins in Day 2 instead of Day 1. Proceeding to the exit always transports the game into Day 4 with Food being 0, which means game over.

    I tried starting the game and deleting the duplicate instance of board, and it seems to work as expected -- however, my game still began on Day 2.

    I commented out InitGame()from Awake() in GameManager and left it in OnLevelFinishedLoading (note that I am using the modified version of OnLevelWasLoaded provided in the upgrade document). While this made the game sort of work as expected, the game still began on Day 2 -- this time, without duplicates.

    A workaround that I found is to set
    Code (CSharp):
    1. private int level = 0
    instead of 1 in GameManager, and remove InitGame()from Awake(). I'm not sure how this will affect the game, but so far into the tutorial (Adding UI & Level Transitions), this workaround seems to make the game on my end behave like the game on the tutorial.

    I checked my scripts and I believe the all match the scripts provided in the tutorial. I'm confident I didn't miss anything. Any reason as to why this is happening?

    Great tutorial, by the way. Thank you for investing your time in this.
     
  4. Smokeythebud

    Smokeythebud

    Joined:
    Aug 9, 2017
    Posts:
    34
    Had the same issue, used the same fix you did in the new update for Unity something with how the scene loading works behind scenes I believe
     
  5. PapaSmoif5

    PapaSmoif5

    Joined:
    Jun 2, 2018
    Posts:
    1
    Thanks a lot for this tutorial :)

    Almost everything works as it should.

    However, I do have a problem. Each time I go to the next level, my input seems to become more and more delayed. After just a few levels it gets significantly annoying and eventually unplayable.
     
  6. OldGhostStalker

    OldGhostStalker

    Joined:
    Jan 18, 2018
    Posts:
    3

    Each Initgame set ups a board and fills it with enemies/walls, so vcalling 2 of them will get you stuck in "invisigle " object from the objects rendered behind.

    Another problem is that "GameManager is somehow a special basi class in unity and unity sometime still references the one in completed folders instead of yours; just rename your gamemanager to something else, references to in included
     
  7. ma53

    ma53

    Joined:
    Jun 7, 2018
    Posts:
    1
    The first level of the game works fine, but once I hit the exit tile, the game just exits and then "day 1" comes back up on my screen. It does not seem to be restarting or loading the second game. When I die, it works and says "after 1 days, you starved", but it just won't load the next day.
     
    Last edited: Jun 7, 2018
  8. Impc7R

    Impc7R

    Joined:
    Jun 8, 2018
    Posts:
    1
    What if you want to change some things. Let's say you add more enemies. How do you exclude new ones from the first levels before you reach a new level? If you had to add if level < 4, do you use RemoveAt/RemoveRange for lists?
     
  9. Smokeythebud

    Smokeythebud

    Joined:
    Aug 9, 2017
    Posts:
    34
    I would modify the function that adds the new enemies to the list only if level is > 4 or whatever
     
  10. Dreaddisk

    Dreaddisk

    Joined:
    Feb 17, 2017
    Posts:
    156
    The items are not being instantiated in my game. What did I do wrong? I miss the outter walls and the food and the enemies.
     

    Attached Files:

  11. Incomitatum

    Incomitatum

    Joined:
    Jan 30, 2015
    Posts:
    6
    I'm on Tutorial 5
    [
    ]

    I'm running into the same issue @lukicamukica had some years ago here
    [ https://forum.unity.com/threads/2d-roguelike-q-a.297180/page-13#post-2509549 ]
    Assets/Scripts/GameManager.cs(18,21): error CS1061: Type `BoardManager' does not contain a definition for `SetupScene' and no extension method `SetupScene' of type `BoardManager' could be found. Are you missing an assembly reference?


    I've made a paste of my scripts.
    [ http://hatebin.com/qmmqapsqmq ]

    Like the commenter said to him all that time ago.

    I HAVE made a blank Object, dropped on the scripts, and filled in the fields properly, while afterwards making it a Prefab.

    Still no dice.

    Any advice you can offer is appreciated. I had a good stride, was learning, and now I've hit a wall. :/

    ===========
    EDIT
    ===========

    I see now, since I created both files like he told me to, but started coding in the wrong one, and then just changed the filenames I ran into the issue that:

    public class GameManager : MonoBehaviour
    public class BoardManager : MonoBehaviour


    were in the opposite files.
     
    Last edited: Jun 26, 2018
  12. Incomitatum

    Incomitatum

    Joined:
    Jan 30, 2015
    Posts:
    6
    Making a new post as I have a new issue. With the issue above fixed, I see the level build when I hit play, but then my I get a red Out of Memory error at the bottom of Unity, just before my PC locks up and needs a hard-reset.

    http://hatebin.com/cqyzmgmqqc

    any ideas why that might be?
     
  13. Incomitatum

    Incomitatum

    Joined:
    Jan 30, 2015
    Posts:
    6
  14. gwnguy

    gwnguy

    Joined:
    Apr 25, 2017
    Posts:
    136
    Just a quick lookover, change line 43
    from: for (int y = 1; x < rows - 1; y++){
    to: for (int y = 1; y < rows - 1; y++){

    Anytime I see an out of memory, I suspect Loops gone Wild, and always take a look at them first
     
  15. Incomitatum

    Incomitatum

    Joined:
    Jan 30, 2015
    Posts:
    6
    Thank you. Such a silly mistake too, but now my machine doesn't lock up and force me to wait through a 5min restart.

    With this, I can at least keep going through the tutorial learning stuff.

    Blessings.
     
  16. ponasoft

    ponasoft

    Joined:
    Oct 6, 2013
    Posts:
    35