Eazy-Sound-Manager icon indicating copy to clipboard operation
Eazy-Sound-Manager copied to clipboard

UnityException FindObjectsOfType

Open KostaDokosic opened this issue 6 years ago • 7 comments

UnityException: FindObjectsOfType is not allowed to be called from a MonoBehaviour constructor (or instance field initializer), call it in Awake or Start instead. Called from MonoBehaviour 'EazySoundManager' on game object 'GameManager'.

Line 68 in EazySoundManager script instance = (EazySoundManager)FindObjectOfType(typeof(EazySoundManager));

KostaDokosic avatar Dec 27 '18 00:12 KostaDokosic

any update on this?

rameshporeddy avatar Jan 12 '19 11:01 rameshporeddy

@LAVendeta @rameshporeddy Sorry for the delay, it was an extremely busy month and I could not work on it.

I will take a look into the issue and update you very soon.

JackM36 avatar Feb 01 '19 13:02 JackM36

any update on this?

OptiHub avatar Mar 09 '20 07:03 OptiHub

Also waiting for update on this. On the meanwhile I just commented that line as I can't perceive any case where variable instance can be set to null while an instance of EZ is still there, and seems to be working without problems.

Peaverin avatar May 13 '20 21:05 Peaverin

any update on this?

indizs avatar May 25 '20 12:05 indizs

Restarting Unity makes the error go away. It started when I added Soundmanager to a GameObject to test something, after deleting it, it seems Soundmanager isnt properly destroyed.

haywirephoenix avatar Mar 10 '22 08:03 haywirephoenix

The problem still persists

IskanderNazarov avatar Oct 26 '22 17:10 IskanderNazarov