Search Unity

  1. If you have experience with import & exporting custom (.unitypackage) packages, please help complete a survey (open until May 15, 2024).
    Dismiss Notice
  2. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice

2d Pack or 2D platformer pack with Unity 5 compatible scripts?

Discussion in 'Scripting' started by DYV, Aug 26, 2015.

  1. DYV

    DYV

    Joined:
    Aug 10, 2015
    Posts:
    58
    Hello
    I am a novice and I can't fix the scripts that included in those Unity Technologies packs to Unity 5. Are there any where these scripts for Unity 5?
    Otherwise I have to load a previous version of Unity despite it's not right decision.
    Any help will be appreciated
     
  2. Code to Reality Studios

    Code to Reality Studios

    Joined:
    Aug 25, 2015
    Posts:
    64
    Certain scripts made in previous Unity versions cannot be updated. But you can try by going to Assets-Run API Updater (I think that is what it is called, its near the bottom of that menu). That will update all of the APIs to the current ones. Hope this helps!
     
  3. DYV

    DYV

    Joined:
    Aug 10, 2015
    Posts:
    58
    thanks for the answer
    yes, API updater runs automatically every time when I load project but alas. There is a message: "Assets/Scripts/Bomb.cs(70,45): error CS0619: `UnityEngine.Component.rigidbody2D' is obsolete: `Property rigidbody2D has been deprecated. Use GetComponent<Rigidbody2D>() instead. (UnityUpgradable)'".
    I think this is not a big deal for codders but this is a problem for me :)
     
    Last edited: Aug 26, 2015
  4. Code to Reality Studios

    Code to Reality Studios

    Joined:
    Aug 25, 2015
    Posts:
    64
    Well, do this to convert.
    Code (CSharp):
    1. //Instead of Component.rigidbody2D do this
    2. Rigidbody2D rigidbody;
    3.  
    4. public Start()
    5. {
    6. //If the rigidbody is on the current object
    7.    rigidbody = GetComponent<Rigidbody2D>();
    8. }
     
  5. DYV

    DYV

    Joined:
    Aug 10, 2015
    Posts:
    58
    Solved by API :)
    thanks to all who answered
     
  6. Code to Reality Studios

    Code to Reality Studios

    Joined:
    Aug 25, 2015
    Posts:
    64
    No problem! Anytime! :D