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
IVerify
interface, it calls theVerify
method 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
IVerify
interface. If it does, it calls theVerify
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)
{
}
}
- Implementation of IVerify Interface: Ensure that the classes you want to verify implement the
IVerify
interface. This interface typically includes aVerify
method where you define your verification logic. - 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 theVerify
method on those implementing theIVerify
interface. - Performing Checks on ScriptableObjects: For ScriptableObjects, simply apply the
CheckVerifyInterface
check to the ScriptableObject asset. If the ScriptableObject implements theIVerify
interface, the check will call itsVerify
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 theVerify
method on components implementing theIVerify
interface.PerformCheck(ScriptableObject sobj)
: Initiates the verification process for ScriptableObjects. If the ScriptableObject implements theIVerify
interface, it calls itsVerify
method.
Attributes
longDescription
: Provides a description of what this check does.