Referencing variables that are within a scriptable object.

I was wondering whether anyone could tell me how to reference variables within a scriptable object?

I have this one script that passes a scriptable object into a second script when a certain trigger happens and I want the second script to then access the variables within the scriptable objects that it receives. For example, the scriptable object contains a string called ‘name’, and I would like the second script to take the contents of that string and enter it into a UI text object.

Could someone please tell me how to do this?

Thank You!

You would do this in exactly the same way as you would any object. eg if you had a reference to a scriptable object stored in the variable myScriptableObject:

string text = myScriptableObject.text;