Unity logo
Cancel
Cart
Applications
Sell Assets

Over 11,000 five-star assets

Rated by 85,000+ customers

Supported by 100,000+ forum members

Every asset moderated by Unity

Home
Tools
Utilities
1/5
This package provides structured success and error handling for Unity projects, enabling efficient debugging and flexible result management for any data type.
Render pipeline compatibility
The Built-in Render Pipeline is Unity’s default render pipeline. It is a general-purpose render pipeline that has limited options for customization. The Universal Render Pipeline (URP) is a Scriptable Render Pipeline that is quick and easy to customize, and lets you create optimized graphics across a wide range of platforms. The High Definition Render Pipeline (HDRP) is a Scriptable Render Pipeline that lets you create cutting-edge, high-fidelity graphics on high-end platforms.
Unity VersionBuilt-inURPHDRP
2022.3.32f1
Compatible
Compatible
Compatible
Description

Search Result Pro takes Unity data handling to the next level, providing developers with advanced, flexible error-handling options. Designed with professional projects in mind, it delivers more comprehensive control over data retrieval, modifications, and comparison.

Search Result Pro builds upon the simplicity of the Lite version, adding expanded functionality for developers seeking a powerful, adaptable solution.


🌐 Website: https://doshagyasinggowardun.weebly.com


💡 Support: https://discord.gg/BkgHX5VnKC


🌱 Lite Version: https://u3d.as/3q4c



Key Features

  • Use Search Result Pro to manage and track errors in complex workflows. Customizable error messages and error-state tracking empower you to isolate issues faster.

  • Modify data dynamically with TryModify(), giving you an easy way to update values when error-free or to debug when errors are flagged.Advanced Error Control

  • Compare error states effortlessly with custom operators (== and !=) to check for successful or faulty data retrieval without additional checks.Flexible Modifications

  • Intuitive Boolean Comparison
    Access ToString() for detailed data and error output, streamlining the debug process and error message handling, even for complex data types.Enhanced Debugging Tools

Key Use Cases in Unity Projects

1. Safe Data Access

  • Lists and Arrays: The SafeGet extension methods for lists and arrays help retrieve elements without worrying about null references, out-of-bounds errors, or runtime crashes. For example:

var myList = new List<int> { 1, 2, 3 };
var result = myList.SafeGet(5);
if (result.isError)
Debug.LogError(result.errorMessage);
else
Debug.Log(result.result);

  • This is especially useful when working with dynamically sized collections, such as inventories, object pools, or runtime-generated datasets.

2. Error Messaging with Context

  • The use of [CallerMemberName] and [CallerLineNumber] attributes in SafeGet methods allows developers to quickly identify where an error occurred in the code. This makes debugging faster and more intuitive.Example: “Index is outside bounds of array at MyMethod at line 42.”

3. GameObject Modifications

  • The SafeModify method provides a structured way to modify GameObjects while handling potential exceptions gracefully. This can be used for tasks such as:Adding or removing components.
    Updating properties (e.g., transform.position, Renderer.material).
    Custom logic based on runtime checks.Example:

GameObject myObject = GameObject.Find("Player");
myObject.SafeModify(obj =>
{
obj.transform.position = new Vector3(0, 1, 0);
}, error => Debug.LogError(error));

4. Preventing Common Errors in Unity

  • Null Reference Exceptions: These extensions ensure that null references are caught and handled before they cause crashes.
  • Index Out-of-Bounds: Improves safety when accessing indices, reducing runtime errors caused by invalid inputs.
  • Runtime Exception Handling: Provides a unified approach to catching exceptions across different object types, ensuring smoother gameplay and debugging.

5. Customization and Extendability

  • By providing a generic structure (SearchResult<T>), this framework allows developers to easily extend functionality to other data types, like custom structs or objects.
  • For instance, a custom extension method could be created for retrieving specific components from a list of GameObjects:

public static SearchResult<T> SafeGetComponent<T>(this GameObject obj) where T : Component
{
if (obj == null)
return SearchResult<T>.Error("GameObject is null");

T component = obj.GetComponent<T>();
return component != null
? SearchResult<T>.Success(component)
: SearchResult<T>.Error($"Component {typeof(T)} not found on GameObject");
}

6. Collaborative Development and Modular Code

  • Enables safer code when multiple developers are working on a project. The clear separation of error handling (e.g., using onError callbacks) and functional logic (e.g., onSuccess) helps streamline debugging and maintenance.
  • Example:

myGameObject.SafeModify(obj =>
{
obj.AddComponent<Rigidbody>();
}, error => Debug.LogError($"Failed to modify GameObject: {error}"));

7. Error Logging for QA and Bug Tracking

  • With precise error messages and contextual information, QA testers can pinpoint issues and provide detailed reports. Developers can also integrate these error messages with bug tracking tools.

Benefits for Unity Developers

  • Reduced Debugging Time: Eliminates the need to manually write boilerplate error checks for common operations.
  • Improved Stability: Prevents crashes caused by common mistakes like accessing null objects or out-of-range indices.
  • Enhanced Collaboration: Clear error reporting ensures team members can quickly identify and resolve issues.
  • Code Reusability: The generic approach and extensible design ensure that these utilities can be reused across various projects and scenarios.

By integrating these utilities into a Unity project, developers can focus on building features and gameplay mechanics rather than worrying about runtime stability.


Use Case: Safe Inventory Management in a Game (Using PRO version)

Scenario

You are building an inventory system for an RPG game. Players can access their inventory to view items or equip them during gameplay. However, there may be cases where the player tries to access an item that doesn’t exist or the inventory is empty. The SearchResultPro class ensures these operations are handled gracefully without breaking the game flow.

Code Example:

using UnityEngine;
using System.Collections.Generic;
using RedstoneinventeGameStudio.Pro.Utilities;

public class InventoryManager : MonoBehaviour
{
private List<string> inventoryItems;

void Awake()
{
// Add a default check to quickly check results before returning
AddDefaultCheck();
}

void Start()
{
TestSafeGet(1); // Null references are also handled

// Initialize inventory with some items
inventoryItems = new List<string> { "Sword", "Shield", "Potion" };

// Use SafeGet to access an item safely
TestSafeGet(1); // Valid index
TestSafeGet(-1); // Invalid index
TestSafeGet(10); // Out of bounds index
}

void TestSafeGet(int index)
{
// Using SafeGet with inline success and error handling
inventoryItems.SafeGet(index,
onSuccess: item => Debug.Log($"Successfully retrieved item: {item}"),
onError: error => Debug.LogError($"Failed to retrieve item: {error}")
);
}

public void EquipItem(int index)
{
// Use SafeGet to retrieve an item before equipping
SearchResultPro<string> result = inventoryItems.SafeGet(index);

if (result)
{
Debug.Log($"Equipping item: {result.result}");
// Equip logic here...
}
else
{
Debug.LogError($"Cannot equip item: {result.errorMessage}");
}
}

public void AddDefaultCheck()
{
// Set a default predicate to prevent equipping empty or invalid item names
SearchResultPro<string>.SetDefaultCheck(item => !string.IsNullOrEmpty(item));
}
}

Features Demonstrated:

  1. Safe Retrieval:
    Use SafeGet to avoid runtime errors when accessing inventory items, especially when indices are out of range.
  2. Error Handling with Callbacks:
    Inline onSuccess and onError callbacks provide immediate and readable handling of success or failure scenarios.
  3. Custom Default Checks:
    Ensure retrieved items meet specific criteria by adding a defaultCheck. For example, prevent equipping items with invalid names.
  4. Implicit Conversion:
    Simplifies error checking with implicit conversion (if (result)), making the code cleaner and easier to understand.
  5. Pro Extensions:
    The extended functionality adds safety and clarity when working with collections like arrays and lists, reducing potential errors and debugging time.

Example Output:

List is empty at TestSafeGet at line 17
Successfully retrieved item: Shield
Failed to retrieve item: Index is outside bounds of array at TestSafeGet at line 24
Failed to retrieve item: Index is outside bounds of array at TestSafeGet at line 25
Equipping item: Sword
Cannot equip item: Index is outside bounds of array

This use case highlights how the Pro Version enhances development by providing robust, reusable, and error-resilient data handling tools. It reduces the need for repetitive null checks, making your codebase more efficient and readable.


Supported Platforms

  • Desktop
  • Android
  • iOS
  • WebGL
  • MacOS
  • Consoles

Why Choose Search Result Lite & Pro?
This asset solves real-world problems faced by Unity developers, making your projects safer, smoother, and easier to manage. The Lite version is perfect for those looking to try safe access methods, while Pro unlocks advanced tools and customization for professional-grade projects.

Take the hassle out of debugging and let Search Result Lite & Pro do the heavy lifting for you.


Get started with Lite for free or upgrade to Pro to unlock the full potential of your workflow!


With ongoing development and user feedback-driven enhancements, Search Result Pro is designed to meet professional-level needs in Unity development. Join our community to share ideas and stay updated on new features!

Technical details

Key Features:

  1. Success/Error Encapsulation: Provides structured handling for both success and error states.
  2. Data Customization: Supports any data type, allowing flexible usage across projects.
  3. Automatic Error Logging: Logs errors on detection, aiding quick debugging.
  4. Safe Data Modification: Modifies variables only if there are no errors, preventing unwanted changes.
  5. Boolean and String Conversions: Supports implicit conversions for simpler logic and messaging.
  6. Operator Overloads: Easy comparison with boolean values for quick checks.
  7. Comprehensive Documentation: Includes setup, usage examples, and detailed method explanations.

Search Result Pro

(not enough ratings)
3 users have favourite this asset
(3)
$10
Seat
1
Updated price and taxes/VAT calculated at checkout
Refund policy
This asset is covered by the Unity Asset Store Refund Policy. Please see section 2.9.3 of the EULA for details.
Secure checkout:
Supported payment methods: Visa, Mastercard, Maestro, Paypal, Amex
License type
File size
139.8 KB
Latest version
1.0
Latest release date
Nov 25, 2024
Original Unity version
2022.3.32
Support
Visit site
Quality assets
Over 11,000 five-star assets
Trusted
Rated by 85,000+ customers
Community support
Supported by 100,000+ forum members
Unity logo
Language
Feedback
Partners Program
Partners
USD
EUR
Copyright © 2025 Unity Technologies
All prices are exclusive of tax
USD
EUR