Search Unity

Unit Testing the type of data saved in a Scriptable Object

Discussion in 'Testing & Automation' started by ultramarinebicycle, Apr 7, 2022.

  1. ultramarinebicycle

    ultramarinebicycle

    Joined:
    Jan 12, 2018
    Posts:
    7
    The title. I basically want to check if the SO has a prefab, the name of the prefab, if it has a field that accepts a component and if yes, what type of component is saved. How do I go about accessing this data?
     
  2. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    6,338
    The normal way you access fields on an object.

    You load the SO asset, if it's an asset, though the AssetDatabase.

    If the fields you want to access are private, either make accessors, or wrap the SO in a SerializedObject and access the fields through that interface.