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

Question Set GameObjects Inspector Automation

Discussion in 'Scripting' started by PAU_L, Jun 16, 2022.

  1. PAU_L

    PAU_L

    Joined:
    Feb 19, 2021
    Posts:
    11
    Hi All,

    Trying to find a solution to a problem that can be formulated as follows:

    Say I have a whole bunch of sprites (.png) and they need to be assigned to an array or a list of Sprites on a particular Game Object.

    What I'd normally do is select the game object so as to show it's properties and components in the inspector then drag the sprites into their corresponding slots.

    My question is how to automate that in Unity? How can one create a script to automatically read .png files from a folder and slot them into the game object where they belong?

    Is this even possible?

    Thanks in advance.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,517
    Yes, generally anything is possible.

    Check out Unity editor scripting and how to create, modify and connect assets.
     
  3. PAU_L

    PAU_L

    Joined:
    Feb 19, 2021
    Posts:
    11
    Had that impression and even worked on some code that used
    ScriptableWizard
    way back and I managed to revive those braincells with some help from an old plugin I've written (bulk GameObject rename plugin). In fact I've managed to get something going earlier with which I'm reasonably pleased. Faith in Unity restored.
     
    Kurt-Dekker likes this.