Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Inspector Events

Discussion in 'Scripting' started by DukeGrimm, Jul 20, 2013.

  1. DukeGrimm

    DukeGrimm

    Joined:
    Sep 29, 2012
    Posts:
    61
    I'm looking to find out how one goes about creating events for the Inspector.
    I want to detect when the editor user has changed a EnumDrop down field.

    When they change the selection, the script would add and remove components based on the selection.

    I.e When Item Type is iMaterial than removeComponent scWeapon and addComponent scMaterial.

    I found a post that seem to mention that creating new events should be possible, but I haven't been able to find any examples to learn from.

    I presume it will require a customEditor which I've started, but I'm not sure how to make an event to detect a change in the inspector, specifically a particular dropdown field.

    Any ideas on how I go about this?
     
  2. DukeGrimm

    DukeGrimm

    Joined:
    Sep 29, 2012
    Posts:
    61