Forum rules - please read before posting.

Get ActionList asset from unity object

edited March 22 in Technical Q&A

I am trying to achieve localisable examine texts with VoiceOver accessibility feature on inventory items at mouseover. I have already done one for hotspots and I have no issues making it work with asset lists that are in the scene. But this time I need to link an external asset list trough inventory item properties. I have an option to use Object as the property type.
Now, how do I turn this Object variable (an external action list asset) into an ActionList variable so that I can access its action?

Comments

  • naturally I can already get to the object in my C# code but I do not know how to make it accessible for this line:

    _invActionList = invInstance.InvItem.GetProperty(2).UnityObjectValue;
    runtimeActionList = AdvGame.RunActionListAsset(_invActionList, 0, 0); //this does not work as the _invActionList is an Object, not an ActionList

  • https://echoesofsomewhere.com/2024/01/04/accessibility-options/
    here is a breakdown into how the solution works with scene based asset lists for hotspots.

  • It should just be a case of casting the UnityObjectValue to an ActionListAsset:

    _invActionList = (ActionListAsset) invInstance.InvItem.GetProperty(2).UnityObjectValue;
    
  • This works perfectly. Thanks!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.