Search Unity

  1. Unity 2019.1 beta is now available.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. We're looking for insight from anyone who has experience with game testing to help us better Unity. Take our survey here. If chosen to participate you'll be entered into a sweepstake to win an Amazon gift card.
    Dismiss Notice
  4. On February 28th the Feedback website will shut down and be redirected to the Unity forums. See the full post for more information.
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Unity 2018.3 is now released.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

[ReorderableList] Cant change Variables inner Foldout tab

Discussion in 'Extensions & OnGUI' started by Pandalawl, Sep 3, 2018.

  1. Pandalawl

    Pandalawl

    Joined:
    Jan 27, 2017
    Posts:
    8
    Hello,

    Im tryin to create a ReorderableList each entry is a ScriptableObject,
    and I wanna create a Foldout tab to hide/show the variables from the ScriptableObject.
    Wich works fine but i cant change the Varaibles anymore....i guess it has something to do with
    elementHeightCallback / elementHeight but idk...p

    Thats my Editor Code so far https://pastebin.com/0pnKdCxK
    thats how it looks
    https://imgur.com/a/ZBbAJ9Z

    pls some Help ;_;
     
    Last edited: Sep 3, 2018
  2. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    673
    I believe you need to call target.ApplyModifiedProperties()

    I would also cache these serializedObjects to a dictionary.
    Rebuild the dictionary on enable and when an object changes
     
  3. Pandalawl

    Pandalawl

    Joined:
    Jan 27, 2017
    Posts:
    8
    So I changed my Script a bit
    https://hastebin.com/ebuhiliqar.cs

    and im using target.ApplyModifiedProperties() at 2 positions
    but it dont change the problem.

    Good idea to cache them to a dictionary, will try that. Thanks
     
  4. PsyKaw

    PsyKaw

    Joined:
    Aug 16, 2012
    Posts:
    93
    In you code, add this when you draw ScriptableObject properties:

    Code (CSharp):
    1. if (item.isExpanded)
    2. {
    3.     SerializedObject target = new SerializedObject(item.objectReferenceValue);
    4.     target.Update();
    5.     // Your code here
    6.     target.ApplyModifiedProperties();
    7. }