Search Unity

'Reverse' the UnityEvent inspector helper to return variables

Discussion in 'Scripting' started by KingRecycle, Nov 6, 2015.

  1. KingRecycle

    KingRecycle

    Joined:
    Jul 20, 2013
    Posts:
    26
    Basically i'm trying to use the cool feature UnityEvents have in the inspector where you can drag objects into it and call functions or set variables in connected components but in reverse. I want to select variable and have it return the variable.

    Code (CSharp):
    1. public UnityEvent var; //In the inspector you set up what variable you want to get
    2.  
    3. myText.text = var.ToString();
    4.  
    5.  
    This is literally just made up code but I hope it gets the point across.
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860