35 lines
743 B
C#
35 lines
743 B
C#
#if UNITY_EDITOR
|
|
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using Newtonsoft.Json;
|
|
|
|
using UnityEditor;
|
|
#endif
|
|
using UnityEngine;
|
|
[ExecuteInEditMode]
|
|
[System.Serializable]
|
|
public class PropScript : MonoBehaviour
|
|
{
|
|
#if UNITY_EDITOR
|
|
public int PropId = 0;
|
|
[HideInInspector]
|
|
public Vector3 LocalPos = Vector3.zero;
|
|
|
|
public void Update()
|
|
{
|
|
LocalPos = this.transform.localPosition;
|
|
}
|
|
|
|
public string ToJson()
|
|
{
|
|
var settings = new JsonSerializerSettings
|
|
{
|
|
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
|
|
};
|
|
return JsonConvert.SerializeObject(new { PropId = PropId, LocalPos = LocalPos }, settings);
|
|
}
|
|
#endif
|
|
}
|