docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Use case: Delete a reaction from an annotation

    Before you start

    Before you delete a reaction from an annotation, ensure you have completed the following prerequisites:

    1. Verify Permissions: Confirm that you have the necessary rights to remove reactions from annotations. Typically, you can only remove reactions that you yourself have added, unless you have administrative permissions.
    2. Identify the Specific Reaction: Determine the exact reaction you want to remove. You'll need both the annotation identifier and the specific reaction type to target the correct reaction.
    3. Understand Reaction Deletion Implications: Be aware that removing a reaction will immediately update the reaction count visible to all users. In collaborative environments, this may affect the perceived sentiment toward the annotation.
    4. Check Reaction Ownership: Verify that the reaction you're trying to delete was added by the current user (or that you have administrative permissions to remove others' reactions).
    5. Set Up SDK Environment: Ensure your Unity environment is properly configured with the Collaboration SDK to interact with the annotation system.

    How do I...?

    Remove a user's own reaction from an annotation

    To remove a reaction that the current user has previously added:

    1. Obtain the Project Identifier: Ensure you have the correct project identifier (GUID) for the project.
    2. Identify the Annotation and Reaction: Determine which annotation and specific reaction type to remove.
    3. Delete the Reaction: Use the SDK to remove the specified reaction.
    4. Update UI Display: Update your user interface to reflect the removed reaction, typically by decrementing the reaction counter and removing the highlight indicating the user had reacted.

    Example:

    var projectId = new ProjectId("example-project-id");
    var annotationId = new AnnotationId("example-annotation-id");
    var code = "thumbs_up"; // Reaction code for 👍
    var cancellationToken = new CancellationTokenSource().Token;
    
    await annotationManagement.DeleteAnnotationReactionAsync(
       projectId: projectId,
       annotationId: annotationId,
       code: code,
       cancellationToken: cancellationToken);
    

    A user can only remove a reaction they’ve previously added. If a user tries to remove a Reaction when there is none, an error will be returned.

    For more information on working with reactions, see the documentation on creating reactions.

    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)