Search Unity

Moving from PreferenceItem to SettingsProvider

Discussion in 'Scripting' started by Marscaleb, Sep 21, 2019.

  1. Marscaleb

    Marscaleb

    Joined:
    Jan 7, 2014
    Posts:
    1,037
    I'm wondering if anyone can help me out with this one.
    I'm porting over an old project to the latest version of Unity. There's a LOT of code that no longer works and has to be updated. But I'm getting caught first thing on some code from a spline tool I bought way back in the day. And since this tool isn't compiling, my code can't access its namespace, so I can't even get to to my own code that I actually know how to update.

    Anyway, the tool I bought hasn't been updated in a while and it seems unlikely that the developer is going to update it. So my only options are to either A) learn a bunch of of code for getting custom tools to add features to the editor, AND learn their obsolete counterparts, both well enough that I can figure out how to update the tool myself, or B) wrap a tourniquet around all my code trying to access the spline tool, AND any code that needs to access those scripts, and so on down the line, so I can start fixing the rest of my game to maybe a playable state, then buy a new spline tool and try to get that working in my game and HOPE that it works better than the spline tool I already had.

    I'm hoping that someone here could help me (to one extent or another) to port over the spline tool code to save me a lot of hassle and headache.
    I don't think I can post the code here since it actually belongs to someone else as part of a paid asset, but beneath the part that says "PreferenceItem" (the old code that is keeping everything from compiling) there is a function "ShowGUI" which simply calls another function in the code, which has several commands calling "EditorGUILayout" and "GUILayout."
    I don't know quite what these are doing, and when I read the documentation on the "SettingProvider" that I'm told I'm supposed to use, I don't see any clear analog to these other functions.

    Does anyone here understand both PreferenceItem and SettingProvider and could direct me to the kinds of changes I need to make to get this code to work now?
     
    Last edited: Sep 21, 2019
  2. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    Sorry, I don't understand why you don't just remove the asset and comment out your code that's referencing it?
     
  3. Marscaleb

    Marscaleb

    Joined:
    Jan 7, 2014
    Posts:
    1,037
    Because it is an integral part of several scripts, which in turn are referenced by other critical scripts. To comment out all that code would be an extensive process that would cut off at least a quarter of my game. This is what I described as wrapping a tourniquet around my code.

    It's not that it can't be done, but it seems like it *should* be easier to fix a couple functions in this asset I bought.