using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
namespace UnityEngine.ProBuilder
{
///
/// A MonoBehaviour that automatically enables and disables the parent GameObject on exiting and enterin playmode, respectively.
///
[DisallowMultipleComponent]
sealed class ColliderBehaviour : EntityBehaviour
{
public override void Initialize()
{
var collision = gameObject.GetComponent();
if (!collision)
collision = gameObject.AddComponent();
collision.isTrigger = false;
SetMaterial(BuiltinMaterials.colliderMaterial);
}
public override void OnEnterPlayMode()
{
var r = GetComponent();
if (r != null)
r.enabled = false;
}
public override void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
var r = GetComponent();
if (r != null)
r.enabled = false;
}
}
}