How the Check Works
This check operates at the GameObject and ScriptableObject level and performs the following functions:
- GameObject Verification: When applied to a GameObject, the check iterates through all components attached to the GameObject. For each component that implements the
IVerifyinterface, it calls theVerifymethod of that component, passing itself as a parameter. This allows the component to perform its verification logic and report results. - ScriptableObject Verification: When applied to a ScriptableObject, the check checks if the ScriptableObject itself implements the
IVerifyinterface. If it does, it calls theVerifymethod of the ScriptableObject, passing itself as a parameter.
When to Use This Check
- Custom Verification Logic: When you have custom classes that implement the
IVerifyinterface 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)
{
}
}
- Implementation of IVerify Interface: Ensure that the classes you want to verify implement the
IVerifyinterface. This interface typically includes aVerifymethod where you define your verification logic. - Performing Checks on GameObjects: Attach the
CheckVerifyInterfacecomponent to GameObjects in your scene or prefab. During runtime or when manually triggered, this check will iterate through the GameObject’s components and call theVerifymethod on those implementing theIVerifyinterface. - Performing Checks on ScriptableObjects: For ScriptableObjects, simply apply the
CheckVerifyInterfacecheck to the ScriptableObject asset. If the ScriptableObject implements theIVerifyinterface, the check will call itsVerifymethod.
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 theVerifymethod on components implementing theIVerifyinterface.PerformCheck(ScriptableObject sobj): Initiates the verification process for ScriptableObjects. If the ScriptableObject implements theIVerifyinterface, it calls itsVerifymethod.
Attributes
longDescription: Provides a description of what this check does.
