Search Unity

Scenes become dark when I switch.

Discussion in 'Editor & General Support' started by Darrare, Mar 13, 2015.

  1. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    When i play the scenes one by one, they are perfectly fine, but when i change from my menuscene to my first level, my first level is far darker than it should be, and as soon as i back out all of my scenes become incredibly dark (basically pitch black.) I have to restart unity for them to look normal again.

    Any ideas?

    http://i.imgur.com/JUXoM6T.jpg
    EDIT: added a screenshot to help describe my issue.
    pic 1 - normal menuscreen
    pic 2 - normal scene1
    pic 3 - scene1 after clicking play button (application.loadlevel("Scene1"))
    pic 4 - what everything looks like from then on out
     
    Last edited: Mar 13, 2015
    BrainSlugs83 and Siddharth_2077 like this.
  2. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    Anyone know anything about this?
     
  3. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    hmmmmmmm. I had /something/ a /bit/ similar when switching DX11 -> 9 targets back in the beta days.
    This is not that.

    Seems almost like you are ending up with more stuff rendered than you want. or something.

    Have you tried using the http://blogs.unity3d.com/2014/07/29/frame-debugger-in-unity-5-0/ to confirm that you are REALLY drawing what you think?
     
  4. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    ill give it a try, lets find out
     
  5. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    cool. best place to start is rip it to nothing.

    Add One White cube in SCENE 1

    Add One White Sphere in SCENE 2

    add a bit of "switching the scene code" attached to a UI button (use the events system to do this with minimal coding)

    Use the frame debugger to see exactly what is being drawn.

    Less "Noise" is usually easier to test ;)

    Good fortune sir


    Perhaps you will find you are ending up with MULTIPLE camera effects being applied?
    (which wouldn't happen in my example there)
    Something of that order.
     
  6. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    so i used the frame debugger after clicking the play button, and i slowly play it to see what it does.

    At no point does it ever draw "correctly" it always renders as dark.

    @twobob, thanks for your help, ill see what i can debug and figure out!
     
  7. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    So are you saying that this is now DIFFERENT to

    "When i play the scenes one by one, they are perfectly fine, but when i change from my menuscene to my first level, my first level is far darker than it should be,"

    if so, then great, report the bug.

    I personally would setup a more "controlled" testing environment.

    Good luck!


    (don't suppose it is a LINEAR -> GAMMA space issue?)

    try switching render targets, Deferred, Forward, linear, gamma, anything.

    Identify what doesn't work and what does.

    is it the same in all profiles?

    This kind of info is critical to get actual helpful responses. : )
     
  8. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    im pretty new to unity, i just used default settings and made a few terrains and wrote a little code, no idea what those things are but ill try to find out
     
  9. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    CNTL + B

    Player Settings.




    settings.JPG
    Hope it helps
     
  10. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    So switching the rendering path to legacy vertex lit worked, its the only one but it makes S*** like shadows not exist

    edit: do i need to rebuild every time i change it?
     
  11. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    hmmmmm... rebuild? what like "Press Play" <-- this is pretty much rebuilding. Welcome to unity.

    Cripes, what is the OS. What Video Card.

    Standard "Actually Useful" error reporting info please.
    Think about what WE don't know about your setup ( at this point, pretty much everything)


    cheers.
     
  12. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    windows 7 64
    AMD Radeon R9 200 series

    Like i said, i havnt used unity much, i didnt know if this was a common error that people often came accross
     
    BrainSlugs83 likes this.
  13. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Sure thing, I got that.
    My apologies if I sometime sound abrupt. I prefer "Clarity of Information" and if I had a dollar for every time I had typed "Think about what WE don't know about your setup" in a tech forum I would be able to employ a large staff ;)

    I have Win 7 64, With an Nvidia card.
    Do you have an alternate machine or alternate card to test with?

    i think I would gather as much info as I could and use the bug reporter in the absence of alternate testing platforms.
    I would also rip off my own arm to get another card to test against before I did that.

    that's just me

    :)
     
  14. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    Ill send it over to my laptop here shortly, i was doing a similar project the other day in unity 4.6 and it was working out fine, figured it was something to do with unity 5.

    i have my old card, but its not installed and would prefer not to have to put it in
     
  15. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Sounds like a plan.
    Yes indeed /not/ having to change hardware is great.

    Until you have to, to know definitively.
    For the record, I go with Nvidia in the hope that when the full physX support comes through the pipeline I will be a very happy bunny.

    I certainly wish you good fortune
     
  16. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    so i did a test, i created a new scene with just a terrain, and it doesnt go all dark after i click the play button. so im assuming its something in the transition with application.loadlevel.

    anything else i could do to transfer scenes aside fromt hat?
     
  17. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Well there is the obvious answer:
    Don't do it at all until it is fixed and just go for a sprawling monolithic scene. (not ideal)

    Or less enjoyable options like: Just wipe down the scene and repopulate the game world with the new content?

    or the even less popular: Put it all in one scene and just ENABLE/DISABLE it based on - say - parent gameObjects

    SCENE1¬
    . . . . . . . - Junk
    . . . . . . . - Junk
    . . . . . . . - Junk

    SCENE2¬
    . . . . . . . - Junk
    . . . . . . . - Junk
    . . . . . . . - Junk

    this all works fine.

    I personally almost never "change scenes"
    Most of my worlds are procedural so... I only ever need about like 10 scripts in my "world" and it is made....
     
  18. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    so i click the play button and go to Scene2 which is ONLY a camera, light, and terrain, whenever i do that, both of my other scenes (menu and scene1) gets black, but scene2 stays normal. Im really confused
     
  19. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    crazy thought:

    Zip up the project, removing any actual assets that you need to protect the Intellectual Property on.
    Post.

    Could be Pebcac.
     
  20. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    The only IP i have in it is my own stuff, which isnt worth anything, and a few assets that dont have any restrictive licencing.

    ill post in a spec
     
  21. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    As long as those assets aren't purchased in the store. Or the Banhammer of Damocles may fall upon our heads.
    (okay: someone may take it down and warn you, no actual hammers or swords)
     
  22. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    nah, i'm just a poor college kid, free assets for me until i can start producing.

    uploading to mediafire
     
  23. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
  24. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
  25. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    hmm... well.. I am not sure I am seeing what you are seeing.

    Although that 1st scene (after main menu) is very dark on my monitor. it is still the same darkness as before the menu loads...

    Looking into it. bear with me
     
  26. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    ill try to give you a little more clear detail to help you debug.

    Open unity: scene 1 and menu appear normal
    Run menu, normal. leave play mode, then run scene 1, normal, leave play mode
    Run menu, normal, click play (runs application.loadlevel("scene1")) scene 1 not normal.
    Leave play mode, its all pitch black except for the trees, scene2 is not, however, its normal

    so im thinking it might be a setting somewhere on my side, but i have no idea about these graphics kinda things
     
  27. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    checking that process - exactly as you describe, one moment please
     
  28. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I see it now
    thinking...
    AllBlack.JPG

    1st instinct - the lightmap is bugged.... digging

    EDIT:

    Hmmm fog is also "broken"
    fogAlsoBroken.JPG

    EDIT EDIT: Throwing expensive resources at it... bear with me
     
    Last edited: Mar 14, 2015
  29. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    you are like some sort of wizard or something
     
  30. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    No, I am just very old, and have been around the block on more platforms than most people have known exist.

    So I tried a conversion to a mesh. and overlaid the two.


    conversionToMesh.JPG

    Let me see if when the new lightmap bakes it breaks the mesh as well... could just be terrain related. I sense that it is.

    But I need to double double check.

    Baking.....

    (note that the fog also does not work on the mesh.... sigh... I can probably fix that)
     
  31. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    also... if this DOESN'T break the mesh... I will send you a conversion (best I can manage in one chunk for something that size) and you can play with that while they fix the bug.

    Which you should report. And honestly: this is probably a reported bug.
    Efforting... one sec. efforting.JPG
     
  32. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    Ill definitely report this, glad to try and help out something thats so darn good and free.
     
  33. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    heh free. well - it is now :)

    If I may take a moment to point out the history of competition in this arena,

    Once upon a time Source Code was all important, little workarounds and Best Practices were tightly guarded secrets that you had to kill yourself for if you accidentally remembered in a public place.

    After a time all this settled down into a "well generally this is the best way to do things" milieu and the companies had to think of new ways to Value Add their products. (The current exception being mobile gpu source code, atm knowing this you must still be watched by ninjas at all times and only eat cyanide pills)

    Let's look at just 3 big players.

    Microsoft went down the "We will sell licenses to a closed platform" route, no brainer, should have been a winner. With optional PC support.
    The 360 Indie store was awful. They never fixed that, the review process was awful and totally random on how you got treated... They never fixed that... this is a typical mistake that most expanding companies make Money > Quality + resources. (IT'S NOT THEIR FAULT THIS IS HOW YOU BECOME BIGGER, well one way) The PC market was subsumed by MS's not-so-secret move to kill DirectX and the remnants were left to drift to other dying projects or its competitors. For the record MS spent way more buying Minecraft then they ever did on the whole of the XNA effort in it's entire history. you know, bit of perspective...
    XNA is now dead.

    UE went down the "Let's make it really cheaper than our competition with their crazy high pricing at 20 bucks a month" (don't ask how much these engines were back in the day, if you had to, you couldn't afford it, we looked at one that wanted around 50k back when Unity was a mere 2.5 and didn't publish to my platform at that time....)
    UE is now free.

    UT had a solid plan that had a fixedish pricing for the pros and a very generous (loss-leading) free business model that more or less paved the way for the Freemium Model to kick the stuffing out of the competition in the end
    Unity is now Free

    Jeepers my lights are still baking... sigh.

    Long story short the new way is trickle sucking money on a low level from very many people.
    Essentially "enforced" crowd funding.

    The numbers add up much nicer and the risk is much lower, plus if you manage to upset a large amount of people through some bug you don't fix? doesn't really matter so much (actually that is an incredibly myopic view that will close your company one day but I digress)

    So... "FREE" , hmm... yes it does not cost you anything to download the client.
    As an older person I can tell you that systems are priced by TCO not RRP.
    We have personally ploughed at LEAST as much as a full pro license into just supporting assets, and ancillary tools.

    Also - whilst I won't name names here, we have been gifted an enormous amount of stuff for our efforts to provide free software for children. Like I could never afford in a few years of saving.

    so the TCO is actually very very high in our case. (plus we bought pro team licenses as we are a registered academic institution)

    So... "FREE", I am very cognizant of the actual person-hours that are occurring - right now - globally - to make these things seem "free", including my support for you right now. :)

    Free, is a very big word. That can actually have a huge cost.

    Careful how you use it ;) Make sure you look it squarely in the teeth before accepting the horse :)

    However, rant aside, UT are currently my fave company in this area (other than the things I have already told them about privately) Well done UT.

    Jeepers my lights are still baking... sigh.

    Let me go see what the hel is taking so long
     
    Last edited: Mar 14, 2015
    AntFitch likes this.
  34. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Editor hung trying to bake the lights...
    I will just make you a nice mesh and chuck it your way.
    Just don't use it in your final game - or if you are going to, let me know and I will get someone to re-export that asset back out for you using one of their personal licenses.

    gimme sec while I clean up this mess
     
    Last edited: Mar 14, 2015
  35. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    Well said. If i was a big time developer, i would see it the way you do. From my point of view, having access to such a valuable resource at my stage of my education is MASSIVE. If i had to pay for it, i probably wouldn't have it. For all we know i may end up the next CEO of some gaming company that changes the world! (high hopes)
     
  36. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Might I make a suggestion then Mr Future CEO.

    Immediately ditch that plan and become the CEO of an entertainments company that laterally does games.
    The future is filled will things of much greater wonder than Flappy Bird.

    Research immersive environments and procedurally self-generating worlds, stop trying to write games - start trying to reinvent what games are.

    Then you can change the world.
     
  37. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    I will remember that, its solid advice.
     
  38. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    I did not include the shader as that is IP protected.

    Its a mesh, you'll figure something out to color it (hint I embedded vertex colors to make it easier)

    Hope it helps. report that bug . I never use terrains anymore - the draw calls are unbearable.
    1000+ to just throw up a menu screen with background?

    1000 for that one scene (in general - there was worse)

    Insanity. I would be happier with about 50.

    Here my example uses around 60 for your entire world, without trees. (and about 30 batched up with the tables, hands, boxes, tat)

    60DrawCalls.JPG
    yes it looks terrible compared to the other one.... you have 900ish draw calls left to improve that. you do the math.

    horrendousResourceUsage.JPG
    Enjoy (look into a free MASS (or controlled) PLACEMENT tree/object TOOL and just ditch terrains mate)
     

    Attached Files:

    Last edited: Mar 14, 2015
  39. Darrare

    Darrare

    Joined:
    Mar 13, 2015
    Posts:
    23
    Thanks man, ill give a try and see how it goes
     
  40. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    here is that same crappy looking vertex lit one given a bit of lighting love.
    bitOfLove.JPG

    Here is your original (with no trees)
    noTreesTerrain.JPG

    with trees
    horrendousResourceUsage.JPG


    Mesh - with hand placed mesh trees = still under 100 draw calls. (trees not even manually batched)

    HandPlacedTrees.JPG

    Differences becoming minimal...
     
    Last edited: Mar 14, 2015
  41. l3fty

    l3fty

    Joined:
    Mar 23, 2013
    Posts:
    87
    I bug-reported similar behaviour a week or so ago, and was told it was a duplicate of a known issue. For me it only happens in editor play mode, doing a pc or mac build and the lighting does not break between scene changes.

    It appears that the ambient light from the sky-box simply breaks and stays black upon scene change. I was able to make it look nicer by changing to gradient ambient source and setting some lighter values at runtime.

    (Those settings are in Window->Lighting and under the environment lighting section)

    Fingers crossed they fix it when they patch :)
     
    BrainSlugs83 and twobob like this.
  42. twobob

    twobob

    Joined:
    Jun 28, 2014
    Posts:
    2,058
    Now THAT is a wizard.

    I doff my pointy hat sir.
     
  43. malviyanpawan

    malviyanpawan

    Joined:
    Oct 24, 2013
    Posts:
    7
    I face the same issue when i open the scene one by one there is no any issue but when i load scene (Application.LoadLevel("GamePlay")); then scene object going black.
    Screen.png
     
  44. VividFoundry

    VividFoundry

    Joined:
    Aug 15, 2013
    Posts:
    1
    BrainSlugs83 likes this.
  45. SilverStorm

    SilverStorm

    Joined:
    Aug 25, 2011
    Posts:
    712
    Yes I am reporting the fix is to disable continuous baking from Auto to manual in the Lighting Window and that fixed it for me.
     
    MD_Reptile and sbrodie like this.
  46. johnq1216

    johnq1216

    Joined:
    Dec 6, 2013
    Posts:
    2
    For me, the black screen issue stopped when I changed the Ambient Light source from Skybox to color. I don't understand it. But it worked for me.
     
    SynoJ and yashpal like this.
  47. AiDev123

    AiDev123

    Joined:
    Sep 7, 2016
    Posts:
    17
    This form is old, but the problem your having is only in the unity editor. If you finish the game and save it as a .exe, it will be fine.
     
  48. RSH1

    RSH1

    Joined:
    Jul 9, 2012
    Posts:
    256
    I'm also getting this bug in the editor. Very annoying and makes testing difficult.
     
  49. husseincheayto

    husseincheayto

    Joined:
    Jan 25, 2018
    Posts:
    3
    have found a way to remove the black screen when switching between scenes in this link:
     
  50. gowthamact2022

    gowthamact2022

    Joined:
    Jun 22, 2021
    Posts:
    10
    Sorry for late reply.. Sorry very late


    Go to window->Rendering->Lighting and click on Generate Lighting.
    A file will be generated after that this problem will be solved...

    Unity editor 2021