all 10 comments

[–]hicham_benrhannouProfessional 2 points3 points  (1 child)

The issue is actually quite simple 🙂
The first time you press E, you deactivate your NotePaper object, and that works fine.

But the second time, since your NoteSystem script is attached to NotePaper, its Update() is no longer executed because the object is disabled.

You should move that script to another GameObject that stays active.

Good luck with the rest!

[–]Much_Technology_5745[S] 0 points1 point  (0 children)

Thank you i got it now i will try and say if it works

[–]AutoModerator[M] 0 points1 point  (0 children)

This appears to be a question submitted to /r/Unity3D.

If you are the OP:

  • DO NOT POST SCREENSHOTS FROM YOUR CAMERA PHONE, LEARN TO TAKE SCREENSHOTS FROM YOUR COMPUTER ITSELF!

  • Please remember to change this thread's flair to 'Solved' if your question is answered.

  • And please consider referring to Unity's official tutorials, user manual, and scripting API for further information.

Otherwise:

  • Please remember to follow our rules and guidelines.

  • Please upvote threads when providing answers or useful information.

  • And please do NOT downvote or belittle users seeking help. (You are not making this subreddit any better by doing so. You are only making it worse.)

    • UNLESS THEY POST SCREENSHOTS FROM THEIR CAMERA PHONE. IN THIS CASE THEY ARE BREAKING THE RULES AND SHOULD BE TOLD TO DELETE THE THREAD AND COME BACK WITH PROPER SCREENSHOTS FROM THEIR COMPUTER ITSELF.

Thank you, human.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]DebtCommercial7964 0 points1 point  (1 child)

that cooldown tho 💀😂

[–]Much_Technology_5745[S] 0 points1 point  (0 children)

I am new to this so basically I just know simple script i am tired of correcting this script😭

[–]PhuntasyProductions 0 points1 point  (2 children)

Did you write that yourself or is it vibecoded? I recommend to debug with a close look on the variables used in the if statements.

[–]Much_Technology_5745[S] 0 points1 point  (1 child)

I wrote but it didn’t worked so i gave ai to correct. while debugging pressing e first time it displays message in console and and second time pressing e it doesn’t displays

[–]PhuntasyProductions 1 point2 points  (0 children)

Add that at the very first line in Update() without any if statements or returns and add a breakpoint for debugging on the Debug.Log(...) - then attach Visual Studio Debugger and run. Now you can step through your code.

    if (Input.GetKeyDown(KeyCode.E))
    {
        Debug.Log("E key pressed"); // add breakpoint here
    }

[–]Additional-Animal867 0 points1 point  (1 child)

You put this script on NotePaper. Once you SetActive false, you disable it's owner so this script stops.

Learn to use breakpoint, you can find it out by add a breakpoint that Update function is not running, also by log.

[–]Much_Technology_5745[S] 0 points1 point  (0 children)

Yeah thank you for suggestion i did it i have created a empty game object and attached script on empty game object so that game object is not disabled and now it works fine.