public class example : MonoBehaviour
{
public static example my_object { get; private set; } ;
float my_player_health=100;
private void Awake()
{
if (my_object != null && my_object != this)
{
Destroy(this);
} else {
my_object = this;
}
DontDestroyOnLoad(this.gameObject);
}
}