how to use the combatant.GetPortrait(PortraitTypeAsset portraitType )? I defined different Portrait Types but can't figure it out how to access through the PortraitTypeAsset. I searched in the forum, but couldn't find an answer.

Has anybody a short example for that? Thank you in advance.

  • Well, you just pass on the portrait type asset you want to use and receive an instance that implements IPortrait, e.g. giving you access to a sprite or texture set up as portraits.

    Portrait type assets are not diretly referenced by the project, so you need to get the asset like any other Unity asset, e.g. via a public field in a component where you can assign it in an inspector.

    What's your use case for that portrait access via script?
    Please consider rating/reviewing my products on the Asset Store (hopefully positively), as that helps tremendously with getting found.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
Sign In or Register to comment.