Files
unity-iso-tools/Assets/IsoTools/Scripts/Internal/IsoPhysicHelper.cs
2016-04-21 01:55:52 +06:00

33 lines
844 B
C#

using UnityEngine;
using System.Collections.Generic;
namespace IsoTools.Internal {
[DisallowMultipleComponent]
[RequireComponent(typeof(IsoObject))]
public class IsoPhysicHelper : MonoBehaviour {
GameObject _isoFakeObject = null;
public GameObject isoFakeObject {
get { return _isoFakeObject; }
}
void Awake() {
hideFlags = HideFlags.HideInInspector;
var iso_object = GetComponent<IsoObject>();
if ( iso_object ) {
_isoFakeObject = new GameObject("_Fake" + gameObject.name);
_isoFakeObject.AddComponent<IsoFakeObject>().Init(iso_object);
_isoFakeObject.hideFlags = HideFlags.HideInHierarchy | HideFlags.NotEditable;
GameObject.DontDestroyOnLoad(_isoFakeObject);
}
}
void OnDestroy() {
if ( _isoFakeObject ) {
DestroyImmediate(_isoFakeObject);
_isoFakeObject = null;
}
}
}
}