Search Unity

  1. Engage, network and learn at Unite Austin 2017, Oct 3 - 5. Get your ticket today!
    Dismiss Notice
  2. Introducing the Unity Essentials Packs! Find out more.
    Dismiss Notice
  3. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice
  4. Unity 2017.1 is now released.
    Dismiss Notice
  5. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  6. Unity 2017.2 beta is now available for download.
    Dismiss Notice

Terrain Toolkit obsolete?

Discussion in 'Editor & General Support' started by StephanLome, Aug 23, 2011.

  1. StephanLome

    StephanLome

    Joined:
    Apr 14, 2011
    Posts:
    15
    I'm getting two errors like:

    Assets/TerrainToolkit/Editor/TerrainToolkitEditor.cs(1071,82): warning CS0618: `UnityEditor.EditorGUILayout.ObjectField(string, UnityEngine.Object, System.Type, params UnityEngine.GUILayoutOption[])' is obsolete: `Check the docs for the usage of the new parameter 'allowSceneObjects'.'

    I just completed the update to 3.4.0f5 and downloaded the toolkit this morning (I'm doing the SnowLevel tutorial at 3D Buzz)

    Should I just wait out the next version of the toolkit?
     
  2. jimmy3dartist

    jimmy3dartist

    Joined:
    May 14, 2010
    Posts:
    2
    I'm using 3.1.0f4 and having issues using the toolkit as well. It seems to load in but I can't seem to access the kit and extra tools.
     
  3. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    toolkit is not obsolete but Unity 3.4 has changed part of the editor API in this context which is causing that warning.
    they shouldn't be errors though only warnings.
     
  4. polytropoi

    polytropoi

    Joined:
    Aug 16, 2006
    Posts:
    647
    it's been working working fine on 3.4 for me, ignoring warnings as usual...
     
  5. StephanLome

    StephanLome

    Joined:
    Apr 14, 2011
    Posts:
    15
    Thanks for the replies.
    I'll forge onward.

    I guess I took the "obsolete" verbiage from the error text which was a bit of subject line overkill.
     
  6. Dreamora

    Dreamora

    Joined:
    Apr 5, 2008
    Posts:
    26,596
    Obsolete in case of code means "we have replaced this with something new, better, easier, cleaner and will at some point in the future remove this" normally :)
    its a way to tell users of the api that you better should update it if you want to remain future safe without breaking existing functionality from one day to the other (its a word that must be on the "mention an you are fired" list of apple going by the OSX track ;))
     
  7. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,466
    Has somebody found a working solution meanwhile to get rid of this warning? I am once more lost with the Unity Scripting Reference :(
     
  8. roto23

    roto23

    Joined:
    Oct 30, 2009
    Posts:
    240
    You should be able to just ignore the warning. Does it compile and run?
     
  9. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,466
    Yes it does, but the warning nags me :)
     
  10. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    31,307
    static function ObjectField (label : String, obj : Object, objType : System.Type, allowSceneObjects : boolean, params options : GUILayoutOption[]) : Object

    So, you stick a "true" or a "false" in there, depending on whether you want to allow scene objects or not.

    --Eric
     
  11. Tiles

    Tiles

    Joined:
    Feb 5, 2010
    Posts:
    2,466
    Thanks Eric, i think i got it working now :)

    Okay, let`s sort it for the lazy ones. It`s about those two lines here:

    Code (csharp):
    1. 1069 - splatPrototype.texture = EditorGUILayout.ObjectField("Cliff texture", splatPrototype.texture, typeof(Texture2D)) as Texture2D;
    2. 1071 - splatPrototype.texture = EditorGUILayout.ObjectField("Texture "+nTextures, splatPrototype.texture, typeof(Texture2D)) as Texture2D;
    I´ve changed them to this now, and have added the allowSceneObjects:true into the expression.

    Code (csharp):
    1. 1069 - splatPrototype.texture = EditorGUILayout.ObjectField("Cliff texture", splatPrototype.texture, typeof(Texture2D), allowSceneObjects : true ) as Texture2D;
    2. 1071 - splatPrototype.texture = EditorGUILayout.ObjectField("Texture "+nTextures, splatPrototype.texture, typeof(Texture2D),allowSceneObjects : true) as Texture2D
    No warning anymore. So i guess and hope that this was the right thing to change. Knocking on wood.
     
    Ash-Blue likes this.
  12. Dubious-Drewski

    Dubious-Drewski

    Joined:
    Aug 19, 2012
    Posts:
    51
    Tiles, you're amazing. Thank you for the fix! Those warnings were annoying, and I wasn't sure how to fix them.

    Benign errors or not, I like to have ZERO alerts when I compile! It just feels better.