Search Unity

Unity Visual Scripting and custom complex objects

Discussion in 'Visual Scripting' started by keteracel, Jul 15, 2021.

  1. keteracel

    keteracel

    Joined:
    Jun 7, 2021
    Posts:
    1
    Hello friends, I've been trialing UVS. In doing so I hit a stumbling block with getting the properties of a custom object from an event.

    upload_2021-7-15_10-33-17.png

    The event has a ValueOutput of Enemy State which is of type Enemy.

    Code (CSharp):
    1. public class Enemy : MonoBehaviour {
    2.  
    3.     public int health;
    4.     public float speed;
    5.  
    6.     // .... etc
    7.  
    8. }
    When I drag from the Enemy State port there is no option to get any of the members of Enemy. I know I could change my event to have these properties granularly defined, but that would mean lots of duplicate effort whenever new properties are added. Is there another way (such as the 'break struct' node in Unreal blueprints)?
     
  2. alexanikiev

    alexanikiev

    Joined:
    Sep 18, 2022
    Posts:
    1

    Attached Files:

    REDACT3D_ likes this.