Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by SirBedlam · Jan 22, 2016 at 06:35 PM · c#mousedoordraggable

Draggable Door Problems

Hello all,

I've recently come across a tutorial on YouTube (here) showing how to have draggable doors like Amnesia, with the 2 scripts included in the description. I applied and set them up just how the video demonstrates, but I'm only getting errors.

First, I get an error when I click (and hold) the mouse button and I'm not even near the door (the error is continuous and builds up as long as I hold down the mouse button):

 NullReferenceException: Object reference not set to an instance of an object
 DragRigidbodyUse.Use () (at Assets/DragRigidbodyUse.cs:177)
 DragRigidbodyUse.FixedUpdate () (at Assets/DragRigidbodyUse.cs:92)


Then, I get a 2nd error when I approach the door and click the mouse, which is also continuous as long as I hold the mouse button down:

 NullReferenceException: Object reference not set to an instance of an object
 DragRigidbodyUse.holdObject () (at Assets/DragRigidbodyUse.cs:149)
 DragRigidbodyUse.FixedUpdate () (at Assets/DragRigidbodyUse.cs:76)


Finally, while I'm at the door, I get a single error every time I release the mouse button:

 NullReferenceException: Object reference not set to an instance of an object
 DragRigidbodyUse.DropObject () (at Assets/DragRigidbodyUse.cs:163)
 DragRigidbodyUse.FixedUpdate () (at Assets/DragRigidbodyUse.cs:79)


I know very little C#, and have tried to understand what's going on, and even asked the original creator of the script for help, but so far, no luck. All of the errors point to the "DragRigidbodyUse" script.

Could someone please help me understand what's going on here? I'm at a loss.

Comment
Add comment · Show 2
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image ShadyProductions · Jan 22, 2016 at 07:56 PM 0
Share

A null reference on an object means that the thing you are trying to access or read, doesn't have exist.

I don't really suggest you just use scripts like this if you have very little experience with it. It is difficult to explain and try to fix your problems when it is just copy and paste code that might not even work efficiently or not even work at all.

avatar image SirBedlam ShadyProductions · Jan 24, 2016 at 05:10 AM 0
Share

It worked in the video, which demonstrated how to use the scripts. $$anonymous$$ost of the comments were satisfied, and well, I've tried just about everything else I've been able to find for draggable doors, and nothing has really worked. Normally I try to really understand what's going on in any third-party scripts I implement, but with these stretching beyond the small bit of C# I understand, I tried and simply couldn't wrap my brain around it. Truthfully, I'm a little desperate here.

EDIT: I know what NullReferenceExceptions are. I just kept running into a wall when trying to figure out what was missing.

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

60 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Rotating object on z axis only when following mouse movements. 0 Answers

Hi im having the error The name `currentFramePosition' does not exist in the current context i can't find a solution can someone help me? 1 Answer

How to tilt a sprite based on pointer position? 1 Answer

Draggable doors problem 0 Answers

How to get only one object to select at a time (in game)? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges