Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Light gone ?

Discussion in 'Getting Started' started by Quast, Jul 19, 2015.

  1. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    I have two scenes in my game "Roll a Ball", first one is the game and there second one is the main menu. when i run it the light gone !!?


    this happen when i run the game from the main menu scene.

    Any solution ?
     
  2. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    It looks like you don't actually have a light in the scene. Click GameObject -> Light -> Directional Light and try running the scene again.

    The editor pane makes it seem like your scene is lit just to make it easier to edit things while working without having to render your actual scene lighting. You could get a preview of what it would actually look like by toggling the little sun icon in the toolbar for the editor window.
     
  3. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    Light inside player as a child
     
  4. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    Could you post a screenshot of the window with the light's settings?
     
  5. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    here is:
     
  6. Schneider21

    Schneider21

    Joined:
    Feb 6, 2014
    Posts:
    3,512
    So why, in your mind, is the light a child of the player? A directional light isn't affected by its position the way a point light is, so having it follow the player around does nothing.

    Try pulling it out from under the player and have it in the scene with the rest of the geometry. Also, you don't have any scripts disabling the light, do you?
     
    Quast likes this.
  7. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    Before Light was not a child but when run the game result is the same. and yes, i don't have script disable light.
    If the nothing change, I will do it again, i will make the game from the began.

    Thank you Schneider21
     
  8. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    I don't think you need to start over from the beginning — just delete that light and create a new one.

    I suspect it's just facing the wrong way, but I'm not sure (I'd need to try out those same transform values and see).

    If you double-click the light object, the editor should center on it, and then you can use the Rotate tool to manually rotate the light. But the default directional light already has a sensible rotation, which is why for now I suggest you just delete your old one, and add a new one.
     
    Schneider21 likes this.
  9. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    I do what you said, and here the result:


    this problem show only when i click on the button of the menu in the second scene !!!
     
  10. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    OK, it looks to me like the directional light is working OK (though maybe it's a bit overbright), but you need to adjust the Ambient light. You do this in the Lighting window (accessed via the Windows menu).

    I haven't actually done this tutorial, so I have no idea what the second scene is or what the menu button there might be doing.
     
  11. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    It's OK.
    I will keep learning other things.
    Thank you guys.
     
  12. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    We've found that sometimes the light doesn't work when the game is run from the editor but it is ok if you do a build. We can't identify any trigger for when it happens, sometimes the lights work fine in the editor then next time you run it they don't, even if all you've done is move one prefab to a new spot then run the game again to see how it looks.
     
    Quast likes this.
  13. Quast

    Quast

    Joined:
    Jul 5, 2015
    Posts:
    560
    You right !! :D
    It run fine when i build it. Its the editor :mad:.
    oh my god, all the time i thinking that i did something wrong :confused:.
    Thank you so much ted :).
     
  14. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    No problem, we first picked this up during a game jam & wasted hours trying to 'fix' it. I had it happen to me again today.
     
  15. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    That's nutty, I guess I've been lucky that I've never run into that. Please do file a bug... it sounds like a hard one to track down, but there's always a chance!
     
  16. tedthebug

    tedthebug

    Joined:
    May 6, 2015
    Posts:
    2,570
    Will do, next time I can get some screenshots as well