You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
730 B
C#
25 lines
730 B
C#
namespace Fusion.Statistics {
|
|
using System;
|
|
using UnityEngine;
|
|
|
|
[DisallowMultipleComponent]
|
|
[AddComponentMenu("Fusion/Statistics/Statistics World Anchor")]
|
|
public class FusionStatsWorldAnchor : MonoBehaviour {
|
|
private void OnEnable() {
|
|
FusionStatsConfig.SetWorldAnchorCandidate(transform, true);
|
|
}
|
|
|
|
private void OnDisable() {
|
|
FusionStatsConfig.SetWorldAnchorCandidate(transform, false);
|
|
}
|
|
|
|
private void OnDestroy() {
|
|
// Saving stats if is child
|
|
var stats = transform.GetComponentInChildren<FusionStatsCanvas>();
|
|
if (stats) {
|
|
stats.transform.SetParent(null);
|
|
stats.GetComponentInChildren<FusionStatsConfig>(true).ResetToCanvasAnchor();
|
|
}
|
|
}
|
|
}
|
|
} |