Ads keep us online. Without them, we wouldn't exist. We don't have paywalls or sell mods - we never will. But every month we have large bills and running ads is our only way to cover them. Please consider unblocking us. Thank you from GameBanana <3

How To Make The Mouse Cursor Appear Over Objects!

A Tutorial for Baldi's Basics

No ads for members. Membership is 100% free. Sign up!
Well, in case you didn't know how (well most of you don't) here is a tutorial on how to make the mouse cursor appear over objects:

First you need to open up OSB if you have a decompile in progress, then you need to go to the Hud and duplicate the Reticle And rename it to Reticle2.

 second you need to make the cursor sprite a 2d sprite and ui, then you have to go back to Reticle2 and make sure the color of it is white and click the circle next to the top box, and if a window pops up with all the textures, you need to scroll down and find the cursor. then click on the create button on the top left box and create empty, and rename it to mouse appearing controller or something like that.

 then add a component and search for mouse appearing script and it might say add a new script, click on that and open the script in visual studio

Once it loads, delete all of the script and paste this in it:

using System;
using UnityEngine;
using UnityEngine.UI;

public class MouseAppearingScript : MonoBehaviour
{
    // Start is called before the first frame update
   private void Start()
    {
        
    }

    // Update is called once per frame
    private void Update()
    {
        Ray ray = Camera.main.ScreenPointToRay(new Vector3((float)(Screen.width / 2), (float)(Screen.height / 2), 0f));
        RaycastHit raycastHit;
        if (Physics.Raycast(ray, out raycastHit) && (raycastHit.collider.tag == "Door" & Vector3.Distance(this.playerTransform.position, raycastHit.transform.position) <= 15f))
        {
            this.MouseCursor.SetActive(true);
        }
        else if (Physics.Raycast(ray, out raycastHit) && (raycastHit.collider.tag == "Item" & Vector3.Distance(this.playerTransform.position, raycastHit.transform.position) <= 10f))
        {
            this.MouseCursor.SetActive(true);
        }
        else if (Physics.Raycast(ray, out raycastHit) && (raycastHit.collider.tag == "Notebook" & Vector3.Distance(this.playerTransform.position, raycastHit.transform.position) <= 10f))
        {
            this.MouseCursor.SetActive(true);
        }
        else
        {
            this.MouseCursor.SetActive(false);
        }
    }
   
    public GameObject MouseCursor;

    public Transform playerTransform;
}

after you paste the script, save it, go back to unity and you might see two boxes in the script box in mouse appearing controller

click on the circle next to the Mouse cursor box and select: Reticle2 then click on the circle next to the player box and select player.

 Go to reticle2 and find the width and height and set both of them to 30 or 20. there you go! your cursor appears over the objects! Make sure to credit me (or not i don't care)

Sign up to access this!

Embed

Share banner
Image URL
HTML embed code
BB embed code
Markdown embed code

Announcement

Yes - Basically BHV

Credits

Key Authors
Basically BHV Ruler Productions Flag
Affiliation
Ruler Productions
Basically BHV Joined 1y ago
Offline
Ruler Productions Flag Affiliation: Ruler Productions
314 points Ranked 50805th
18 medals 1 legendary 1 rare
  • Returned 5000 times Medal icon
  • Returned 1000 times Medal icon
  • Submission featured Medal icon
  • Returned 100 times Medal icon
  • Became a Studio Leader Medal icon
  • One month a member Medal icon
Creator
Original Authors
Paulor94
Paulor94 Joined 2y ago
Offline
1,306 points Ranked 22680th
16 medals 3 rare
  • Returned 1000 times Medal icon
  • Submitted 20 Gamefiles Medal icon
  • Reached 50 subscribers Medal icon
  • One month a member Medal icon
  • Submitted 5 Gamefiles Medal icon
  • Returned 100 times Medal icon
The answer on Baldiisagoodperson's question!

Submitter

Basically BHV Joined 1y ago
Exited
Ruler Productions Flag Affiliation: Ruler Productions
314 points Ranked 50805th
18 medals 1 legendary 1 rare
  • Returned 5000 times Medal icon
  • Returned 1000 times Medal icon
  • Submission featured Medal icon
  • Returned 100 times Medal icon
  • Became a Studio Leader Medal icon
  • One month a member Medal icon
Basically BHV Ruler Productions Flag
Affiliation
Ruler Productions

Creator
Sign up to access this!
Sign up to access this!
Sign up to access this!

Game

Sign up to access this!

Category

Details

Difficulty Level
Beginner

Attributes

Share

  • Share on Reddit
  • Share on Twitter
  • Share on Facebook
  • 3
  • 1.5k
  • 9
  • 2mo
  • 2mo

More from Submitter

WiPs by Submitter

More Decompile Tutorials