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

how to reference from multipule mono classes to non mono class under certain conditions

Discussion in 'Scripting' started by halevi, Apr 25, 2022.

  1. halevi

    halevi

    Joined:
    Dec 13, 2020
    Posts:
    35
    i have list of path nods vectors, the nods exist in the scene but they not move during the gameplay since they only nods.. and i need to get the list nods reference from multipule mono instances of the same class,
    because I do not need the class of the nods list to be mono since the nods static during the gameplay I thought to create non mono class for the list of the vectors and access to this class from all the mono scripts but i want it to be in the following conditions and understanding if it possible,
    1.i need the list of the nods to be visible in the inspector .
    2.to reference to the same list of nods from all mono classes and not to make new instance of nods list in each mono instance class.
    3.preferable but less critical, to make only one reference from all mono instances to the nods list.
    thanks in advance.
     
  2. Dextozz

    Dextozz

    Joined:
    Apr 8, 2018
    Posts:
    493
    Probably scriptable objects.
     
  3. halevi

    halevi

    Joined:
    Dec 13, 2020
    Posts:
    35
    but i cant grab node instance from the scene to scriptble since the scriptble only alive in the asset , i only can copy the position manually to the inspector but it's cumbersom process