Search Unity

Question How to make a sleeping mechanism when pressing E near a bed?

Discussion in 'Scripting' started by Steeeeeeeeeeeee3l, Mar 6, 2023.

  1. Steeeeeeeeeeeee3l

    Steeeeeeeeeeeee3l

    Joined:
    Feb 15, 2023
    Posts:
    1
    I need a script on how to make it where if I press E near a bed I will start sleeping in the bed!
     
  2. spiney199

    spiney199

    Joined:
    Feb 11, 2021
    Posts:
    7,929
    Not to be rude, but this isn't how the forums work. We aren't here to write code for you, we're here to assist when you have given your best shot and exhausted all other options.

    Sleeping mechanics as well are usually one part of a much greater number of systems. It's nothing something that can be coded in isolation.

    If you want something to do the code for you, ask ChatGPT and see how far that gets you.
     
    Last edited: Mar 6, 2023
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,743
    Yes, what Spiney says... The purpose of this forum is to assist people who are ready to learn by doing, and who are unafraid to get their hands dirty learning how to code, particularly in the context of Unity3D.

    This assumes you have at least written and studied some code and have run into some kind of issue.

    If you haven't even started yet, go check out some Youtube videos for whatever game design you have in mind. There are already many examples of the individual parts and concepts involved, as there is nothing truly new under the sun.

    If you just want someone to do it for you, you need go to one of these places:

    https://forum.unity.com/forums/commercial-job-offering.49/

    https://forum.unity.com/forums/non-commercial-collaboration.17/

    https://livehelp.unity.com/?keywords=&page=1&searchTypes=lessons

    You may consider trying your luck at ChatGPT. However, if you cannot understand the code ChatGPT makes you, nobody here can either. Remember this is YOUR game, not ours. We have our own games we're working on.
     
    Ryiah and mopthrow like this.