Search Unity

Linking objects - Automatically adding to both

Discussion in 'Immediate Mode GUI (IMGUI)' started by Wannabeuk, Feb 4, 2017.

  1. Wannabeuk

    Wannabeuk

    Joined:
    Feb 19, 2013
    Posts:
    62
    So I've written a system for power in my game with generators, transfer and consumers. each of these have inputs and outputs. These are handled by a simple list. So (Ignoring transfer for simplicity) a generator has an output to a lamp, and the lamp has an input of the generator.

    What I'm finding while working on this is its a bit of a pain to add an output and then have to select the other object and add a matching input. What i would really like is to have the inspector automatically handle the other side for me, But I have to admit to being a little stumped on how to go about this.

    I've though of using a method to add to this list, which would check and add the matching link if it wasn't already there. However that means i then can't link via the inspector. I'd really love to have the same system i have now (Simply dragging an output on the output list) which automatically handles the linking.

    I've already got a editor mod that shows me the current links (Simple lines in the scene window coloured for input or output) but if i can get the above working it could save me some serious headaches and time.

    Thanks in advance.