I'm building a custom editor tool where I want to display an organised and optionally filtered list of Combatants. I want to add a category filter where the user can view only combatants that belong to that category. After searching through the docs, CombatantType seems to do what I want.

I can't seem to find more documentation or tutorials on this subject, and I'm wondering what the "Item Type" property actually represents. What is the function of CombatantType and how should it be used?
  • The ORK editor already offers filter options like that - expand the Search/Filter foldout above the combatant listing and you can filter by combatant type and (starting) class.

    The combatant type can be used for different things, e.g. organizing your stuff in the editor, have additional content information on combatants, do condition checks, use it in bestiary menus, etc.

    The item type on combatants is purely for selling them in shops :)
    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!
  • This is useful indeed! Although I am trying to extend/integrate ORK by listing combatants in my own editor window, so that I can place combatants in the scene via a custom editor (instead of dragging prefabs). Since the editor part of the framework is close-source, I got a few related questions:

    ORKFramework.ORK reference doesn't seem to work at editor time. It appears to not be initialized, but if I do initialize it myself, it stops working (main menu no longer shows) when I enter play mode. How should I get a reference to the list of combatants in the editor?

    This is probably too good to be true, but by any chances, is the code for search/filter combatants usable outside the ORK Framework Editor?
  • edited March 2021
    Generally, you can use ORK's scene wizard to add combatants via Combatant Spawners.

    If you wanna go with prefabs and a custom editor, you need to initialize ORK to be able to access the data, put this as the first thing in your editor code, before accessing any ORK data:
    if(!ORK.Instantiated)
    {
    ORK.Initialize(ORKAssetHelper.LoadORKProject());
    }


    The search/filter stuff can't be used outside the ORK editor, it's too specific for that part to be used elsewhere :)
    Post edited by gamingislove on
    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!
  • Instantiating ORK works, except as long as the editor window remains open, the main menu (from ORK) disappears :/

    More specifically, if I have already initialized ORK in the editor, then when I enter play mode, the _ORK UI canvas is not created.
  • That's strange - ORK's own inspectors use the same functionality and it works fine ...
    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!
  • But wait - surely ORK's own inspector would use something different, or my custom Editor Window won't ever find ORK.Instantiated to return false?

    Also, it seems like when instantiated is called, I am reading all the latest, unsaved changes from the project asset, while these changes may still be discarded. Therefore I'm assuming ORK's own editor scripts are actually using a private copy of the project asset - is that not the case?
  • edited March 2021
    Upon further analysis, I think the problem isn't with how I'm calling Initialize in the editor, but rather, if the Editor Window is open when I hit play, then the Editor Window will initialize ORK first. Perhaps when ORK is initialized by something else rather than the game starter, the start menu won't be shown?

    Edit: making the editor window not initialize ORK if we are exiting editor mode fixes this, but I think game starter should probably still create the main menu even if ORK is initialized.
    Post edited by Flying_Banana on
  • The game starter is only used if ORK isn't yet initialized to prevent it from starting again when you e.g. reload the main menu scene.

    For calling the main menu, it's better to handle that in Menus > Main Menu, the game starter just has some options for quick testing these things :)
    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.