Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

+2 votes

Hi all.

Here's a quick script you can use for finding game objects with duplicated scripts, instead of having to go manually through all of them. 
The example is currently looking for AkSurfaceReflector scripts, but you can replace that with any other type of component. 


using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class FindAkSurfaceReflectorDuplicates : MonoBehaviour
{
    public List<GameObject> akSurfComps = new List<GameObject>();

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            AkSurfaceReflector[] objects = GameObject.FindObjectsOfType<AkSurfaceReflector>();
            print("Total Amount of AkSurfaceReflectors: "+objects.Length);
            for (int i = 0; i<objects.Length; i++)
            {
                if (akSurfComps.Contains(objects[i].gameObject))
                {
                    Debug.Log(objects[i].gameObject.name + " has duplicated AkSurfaceReflector Scripts.", objects[i].gameObject);
                }
                else {
                    akSurfComps.Add(objects[i].gameObject);
                }
            }
            if (akSurfComps.Count < 1) {
                print("You have no objects with duplicated AkSurfaceReflector scripts.");
            }
        }  
    }
}


The game object name will be shown in the console on pressing 1 on your keyboard, and you can click on it in the console to highlight it in the Hierarchy.

in General Discussion by Mads Maretty S. (Audiokinetic) (40.2k points)

Please sign-in or register to answer this question.

...