Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

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

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

  1. Steeeeeeeeeeeee3l


    Feb 15, 2023
    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


    Feb 11, 2021
    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


    Mar 16, 2013
    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:

    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.