Skip to content

Commit 4e92323

Browse files
authored
Create WhoDisabledOrEnabled.cs
1 parent 1a4b193 commit 4e92323

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// shows who disabled/enabled this gameobject from another script
2+
// usage: attach to gameobject that you want to track (see console stack trace)
3+
4+
using UnityEngine;
5+
6+
namespace UnityLibrary
7+
{
8+
public class WhoDisabledOrEnabled : MonoBehaviour
9+
{
10+
private void OnDisable()
11+
{
12+
Debug.LogError("OnDisable: " + gameObject.name, gameObject);
13+
}
14+
15+
private void OnEnable()
16+
{
17+
Debug.LogError("OnEnable: " + gameObject.name, gameObject);
18+
}
19+
}
20+
}

0 commit comments

Comments
 (0)