question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instance isn't found if class is on a disabled GameObject.

See original GitHub issue

https://github.com/Microsoft/MixedRealityToolkit-Unity/blob/62491815d88337f8cf98060c1d45e6d19554eae1/Assets/HoloToolkit/Utilities/Scripts/SingleInstance.cs#L21 If the derived class is attached to an object that starts out as disabled, its Instance won’t be found because the method used here doesn’t find disabled objects. changing to use Resources.FindObjectsOfTypeAll<T>(); resolves the issue.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenHodgsoncommented, Oct 12, 2017

Going to remove the bug label on this. Doesn’t really fit because a Singleton based on Monobehaviour will never be found.

1reaction
timGerkencommented, Oct 11, 2017

The spew for having >1 still seems valid, though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there no way to get reference of inactive gameObject?
if the Object is disabled. Just use "Resources.FindObjectsOfTypeAll" it finds everything thats loaded, including disabled objects.
Read more >
Find inactive GameObject by name, tag or layer
The problem is that Unity cannot find inactive GameObjects. GameObject.Find will only find active GameObject. You should either find and ...
Read more >
Can't detect when an inactive gameobject is destroyed. ...
Yo! I am trying to call a "deconstructor" type method inside a script that currently resides in an inactive gameobject.
Read more >
Scripting API: GameObject.SetActive
Activates/Deactivates the GameObject, depending on the given true or false value. A GameObject may be inactive because a parent is not active. In...
Read more >
Object.FindObjectsOfType - Scripting API
Objects attached to inactive GameObjects are only included if inactiveObjects is set to true. Use Resources.FindObjectsOfTypeAll to avoid these limitations. In ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found