Is there a way to check through code if a guid (combatant, factions...) is valid?
  • edited February 21
    The various .Find methods will return null if not found.

    For example, something we do to change the recipe icon color to red if the user can't create a given crafting recipe:

    var recipe = ORK.CraftingRecipes.Find(parsedRecipeName.text);
    if (recipe != null)
    {
    var color = recipe.Settings.CanCreate(ORK.Menu.GetMenuUser()) ? Color.white : Color.red;

    parsedRecipeIcon.color = color;
    }
    Post edited by Acissathar on
  • Find method is for finding by name, for GUIDs you simply need to use a Get method and check if it returns null, e.g.:
    Item item = ORK.Items.Get("YOURGUID");
    if(item != null) // valid
    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!
  • Perfect, thank you Nicholas!
Sign In or Register to comment.