Verify Interface

How the Check Works

This check operates at the GameObject and ScriptableObject level and performs the following functions:

  1. GameObject Verification: When applied to a GameObject, the check iterates through all components attached to the GameObject. For each component that implements the IVerify interface, it calls the Verify method of that component, passing itself as a parameter. This allows the component to perform its verification logic and report results.
  2. ScriptableObject Verification: When applied to a ScriptableObject, the check checks if the ScriptableObject itself implements the IVerify interface. If it does, it calls the Verify method of the ScriptableObject, passing itself as a parameter.

When to Use This Check

  • Custom Verification Logic: When you have custom classes that implement the IVerify interface and you want to ensure they are properly verified.
  • Consistent Verification: To maintain consistency in your project’s verification process by centralizing verification checks.

How to Use the Check

public class PlayerManager: MonoBehaviour, IVerify 
{   
    public int playerScore = 0;   
    public int playerHealth = 100;
          
    public void IncreaseScore(int amount)   
    {       
        playerScore += amount;       
        Debug.Log("Score: " + playerScore);   
    }
     
    public void Verify(CheckVerifyInterface checker)   
    {  
        
    }  
}
  1. Implementation of IVerify Interface: Ensure that the classes you want to verify implement the IVerify interface. This interface typically includes a Verify method where you define your verification logic.
  2. Performing Checks on GameObjects: Attach the CheckVerifyInterface component to GameObjects in your scene or prefab. During runtime or when manually triggered, this check will iterate through the GameObject’s components and call the Verify method on those implementing the IVerify interface.
  3. Performing Checks on ScriptableObjects: For ScriptableObjects, simply apply the CheckVerifyInterface check to the ScriptableObject asset. If the ScriptableObject implements the IVerify interface, the check will call its Verify method.

Methods

  • PerformCheckForProject(): This method does not perform any project-level checks and is empty in this implementation.
  • PerformCheck(GameObject obj): Initiates the verification process for GameObjects. It iterates through components attached to the GameObject and calls the Verify method on components implementing the IVerify interface.
  • PerformCheck(ScriptableObject sobj): Initiates the verification process for ScriptableObjects. If the ScriptableObject implements the IVerify interface, it calls its Verify method.

Attributes

  • longDescription: Provides a description of what this check does.
Was this page helpful?