Terrain Toolkit obsolete?

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?

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.

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.

it’s been working working fine on 3.4 for me, ignoring warnings as usual…

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.

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 :slight_smile:
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 ;))

Has somebody found a working solution meanwhile to get rid of this warning? I am once more lost with the Unity Scripting Reference :frowning:

You should be able to just ignore the warning. Does it compile and run?

Yes it does, but the warning nags me :slight_smile:

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

Thanks Eric, i think i got it working now :slight_smile:

Okay, lets sort it for the lazy ones. Its about those two lines here:

1069 - splatPrototype.texture = EditorGUILayout.ObjectField("Cliff texture", splatPrototype.texture, typeof(Texture2D)) as Texture2D;
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.

1069 - splatPrototype.texture = EditorGUILayout.ObjectField("Cliff texture", splatPrototype.texture, typeof(Texture2D), allowSceneObjects : true ) as Texture2D;
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.

1 Like

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.