Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Unity / SteamAudioSource.cs ] System.InvalidOperationException: Handle is not initialized. #369

Open
AlmazowFaradey opened this issue Aug 23, 2024 · 3 comments

Comments

@AlmazowFaradey
Copy link

System Information
Please provide the following information about your system:

  • Steam Audio version: 4.5.3
  • Unity version: 2022.3.37f1
  • Operating System: Windows 11
  • CPU architecture: x64

Issue Description
SteamAudio does not create sound properly in any way, it does not reflect off the walls, is not calculated, is not muted in case of obstacles (Does not work at all), but when debugging starts in the visual studio, instantly (When the game is not even included in the Editor), debugging immediately stops in the SteamAudioSource file.CS and raises an exception stating that "Handle is not initialized".

Detailed error:
System.InvalidOperationException: Handle is not initialized.
at System.Runtime.InteropServices.GCHandle.Free () [0x00034] in :0
at SteamAudio.SteamAudioSource.Finalize () [0x00000] in E:\Path-To-Project\Project_Name\Assets\Plugins\SteamAudio\Scripts\Runtime\SteamAudioSource.cs:230

Steps To Reproduce
Steps to reproduce the behavior:

  1. Install SteamAudio using .unitypackage;
  2. Specify the use of SteamAudio in the Unity settings;
  3. Open regular scripts in the Unity project in Visual Studio (I have version 2022);
  4. Start debugging the project in Visual Studio;
  5. Run debugging from Visual Studio as a session in Unity;
  6. See the error as "Handle is not initialize"

image

@achandak
Copy link
Collaborator

Hi @AlmazowFaradey - I am not able to reproduce this issue on our end. I created a standalone project in Unity 2022.3.14 and imported latest version of Steam Audio.

Let me know if there is a standalone minimal repro you are able to share.

@jackyyang09
Copy link

I can't confirm if SteamAudio is broken like in AlmazowFaradey's case in my own project, but I've managed to reproduce the debugging issue in a separate smaller project.

On my side, I used Unity 2022.3.39f1 using URP with the latest version of Steam Audio (4.5.3). I also use Visual Studio 2022.

Steps to Reproduce

  1. Enable Steam Audio in the Project Settings.
  2. In the current scene (SampleScene.unity), create a new GameObject.
  3. Add an AudioSource and attach a SteamAudioSource component
  4. Create a new Monobehaviour class "Test.cs"
  5. Open the class in Visual Studio and attach the debugger
  6. Enable debugging in Unity when prompted
  7. Enter Play Mode in Unity
  8. Unity will begin "Reloading Domain" and immediately get caught by an exception in the debugger
    image

I've found that this issue can be avoided by turning on the debugger during runtime well after Unity has entered Play Mode

I've encountered this issue on two computers, one running Windows 10 and another running Windows 11.

I can provide the full project if needed, but creating a new project using Unity's 2D URP template should be sufficient for reproducing the issue.

@lakulish
Copy link
Collaborator

lakulish commented Oct 7, 2024

@jackyyang09 This issue was fixed in the following commit: c565da2. You can get the latest version of SteamAudioSource.cs, which should resolve the issue.

This will, of course, be part of the next official release of Steam Audio.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants