Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Deluxechin · Dec 15, 2015 at 11:20 PM · errorerror message

Unknown error

So i decided to upgrade my unity a few days ago (from 5.0-5.3) when it got within the program stuff starting getting weird i couldn't import images, I couldn't change settings and the game i made's camera was way off and was being stupid, So i decide to uninstall it and reinstall 5.0, but when i opened it i keep getting this error and have no idea what it means, and on all my gameobjects that have scripts saying there's errors and need fixing, in the console i have this error error CS1061: Type UnityEngine.SpringJoint2D' does not contain a definition for enableCollision' and no extension method enableCollision' of type UnityEngine.SpringJoint2D' could be found (are you missing a using directive or an assembly reference?) the script i have this error for is this using UnityEngine; using System.Collections;

public class MouseManager : MonoBehaviour {

 public bool useSpring = false;

 public LineRenderer dragLine;

 Rigidbody2D grabbedObject = null;
 SpringJoint2D springJoint = null;

 float velocityRatio = 4f;     // If we aren't using a spring

 void Update() {
     if( Input.GetMouseButtonDown(0) ) {
         // We clicked, but on what?
         Vector3 mouseWorldPos3D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         Vector2 mousePos2D = new Vector2(mouseWorldPos3D.x, mouseWorldPos3D.y);

         Vector2 dir = Vector2.zero;

         RaycastHit2D hit = Physics2D.Raycast(mousePos2D, dir);
         if(hit.collider!=null) {
             // We clicked on SOMETHING that has a collider
             if(hit.collider.GetComponent<Rigidbody2D>() != null) {
                 grabbedObject = hit.collider.GetComponent<Rigidbody2D>();

                 if(useSpring) {
                     springJoint = grabbedObject.gameObject.AddComponent<SpringJoint2D>();
                     // Set the anchor to the spot on the object that we clicked.
                     Vector3 localHitPoint = grabbedObject.transform.InverseTransformPoint(hit.point);
                     springJoint.anchor = localHitPoint;
                     springJoint.connectedAnchor = mouseWorldPos3D;
                     springJoint.distance = 0.25f;
                     springJoint.dampingRatio = 1;
                     springJoint.frequency = 5;

                     // Enable this if you want to collide with objects still (and you probably do)
                     // This will also WAKE UP the spring.
                     springJoint.enableCollision = true;

                     // This will also WAKE UP the spring, even if it's a totally
                     // redundant line because the connectedBody should already be null
                     springJoint.connectedBody = null;
                 }
                 else {
                     // We're using velocity instead
                     grabbedObject.gravityScale=0;
                 }

                 dragLine.enabled = true;
             }
         }
     }

     if( Input.GetMouseButtonUp(0) && grabbedObject!=null ) {
         if(useSpring) {
             Destroy(springJoint);
             springJoint = null;
         }
         else {
             grabbedObject.gravityScale=1;
         }
         grabbedObject = null;
         dragLine.enabled = false;
     }

 }


 void FixedUpdate () {
     if(grabbedObject != null) {
         Vector2 mouseWorldPos2D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
         if(useSpring) {
             springJoint.connectedAnchor = mouseWorldPos2D;
         }
         else {
             grabbedObject.velocity = (mouseWorldPos2D - grabbedObject.position) * velocityRatio;
         }
     }
 }

 void LateUpdate() {
     if(grabbedObject != null) {
         if(useSpring) {
             Vector3 worldAnchor = grabbedObject.transform.TransformPoint(springJoint.anchor);
             dragLine.SetPosition(0, new Vector3(worldAnchor.x, worldAnchor.y, -1));
             dragLine.SetPosition(1, new Vector3(springJoint.connectedAnchor.x, springJoint.connectedAnchor.y, -1));
         }
         else {
             Vector3 mouseWorldPos3D = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             dragLine.SetPosition(0, new Vector3(grabbedObject.position.x, grabbedObject.position.y, -1));
             dragLine.SetPosition(1, new Vector3(mouseWorldPos3D.x, mouseWorldPos3D.y, -1));
         }
     }
 }

}

Please help

Comment
Add comment
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

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

36 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

Related Questions

How to fix a compiler error? 2 Answers

An instance of type 'UnityEngine.Behaviour' is required to access non static member 'enabled'. 0 Answers

Unable to get VRTK 3.2.1 working in Unity 5.6,Unable to get VRTK 3.2.1 to run in Unity 5.6 0 Answers

Hundreds off errors n console upon starting Unity 2018.3.9f1 related to "has no meta file" 0 Answers

How do I fix this Text Mesh Pro Error? 0 Answers


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