Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How can I edit attributes of objects via scripting

Discussion in 'Scripting' started by JBlalock, Jan 14, 2019.

  1. JBlalock

    JBlalock

    Joined:
    Jan 14, 2019
    Posts:
    2
    Basically I am trying to write a toolchain for my game that can edit the playable characters for the game. How can I write an editor window that can load individual animation files from the assets folder (and subfolders), load their information into a bunch of input fields in an editor window, make any changes I want to them, and save them back to the disk?

    BTW I am sort of new to extending functionality to the editor as all the scripting I have done in the past only involved gameplay.
     
  2. WallaceT_MFM

    WallaceT_MFM

    Joined:
    Sep 25, 2017
    Posts:
    394
    lordofduct likes this.
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,520
    Look into ScriptableObjects (also known colloquially as "Unity3D bags-o-data") and start learning custom inspector scripting, which coincidentally can apply to many types of objects, not just ScriptableObjects.

    Unity is by far the easiest and most-flexible environment for that sorta custom editor extension stuff that I have ever seen. Learn it and you will be very happy.
     
  4. JBlalock

    JBlalock

    Joined:
    Jan 14, 2019
    Posts:
    2
    The main problem I am having is that I some animation files in "Assets/sprites/characterName/anim" for each of my characters for my game. How can I load the properties of the animation files and change them via scripting. I will eventually pick up on the EditorWindow class when it comes the actually designing the interface, I just need to get my data from the animation files so I can manipulate them and apply the changes.
     
  5. WallaceT_MFM

    WallaceT_MFM

    Joined:
    Sep 25, 2017
    Posts:
    394