first commit
This commit is contained in:
53
NitroxUnity/Assets/Editor/CreateAssetsBundle.cs
Normal file
53
NitroxUnity/Assets/Editor/CreateAssetsBundle.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Assets.Editor
|
||||
{
|
||||
public static class CreateAssetBundles
|
||||
{
|
||||
private const string UNITY_DIRECTORY = "AssetBundles";
|
||||
private const string NITROX_DIRECTORY = "../Nitrox.Assets.Subnautica/AssetBundles";
|
||||
|
||||
[MenuItem("Nitrox/Build AssetBundles")]
|
||||
private static void BuildAllAssetBundles()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Directory.Exists(UNITY_DIRECTORY))
|
||||
{
|
||||
Directory.Delete(UNITY_DIRECTORY, true);
|
||||
}
|
||||
|
||||
Directory.CreateDirectory(UNITY_DIRECTORY);
|
||||
|
||||
BuildPipeline.BuildAssetBundles(UNITY_DIRECTORY, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows64);
|
||||
|
||||
if (Directory.Exists(NITROX_DIRECTORY))
|
||||
{
|
||||
foreach (string assetBundleName in AssetDatabase.GetAllAssetBundleNames())
|
||||
{
|
||||
if (assetBundleName == "AssetBundles" || assetBundleName.Contains(".manifest"))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
File.Copy(Path.Combine(UNITY_DIRECTORY, assetBundleName), Path.Combine(NITROX_DIRECTORY, assetBundleName), true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new DirectoryNotFoundException(NITROX_DIRECTORY + " wasn't found");
|
||||
}
|
||||
|
||||
Debug.Log("Building Nitrox AssetBundles successfully finished");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError("Building Nitrox AssetBundles successfully failed");
|
||||
Debug.LogException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
12
NitroxUnity/Assets/Editor/CreateAssetsBundle.cs.meta
Normal file
12
NitroxUnity/Assets/Editor/CreateAssetsBundle.cs.meta
Normal file
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 72bc95f559c295f4b858da3740349244
|
||||
timeCreated: 1546949502
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
2318
NitroxUnity/Assets/Editor/NitroxTestReference.unity
Normal file
2318
NitroxUnity/Assets/Editor/NitroxTestReference.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
NitroxUnity/Assets/Editor/NitroxTestReference.unity.meta
Normal file
7
NitroxUnity/Assets/Editor/NitroxTestReference.unity.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6d0576ed91adcb48899ad005f36ca19
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
89
NitroxUnity/Assets/Editor/NitroxTestShowTransform.cs
Normal file
89
NitroxUnity/Assets/Editor/NitroxTestShowTransform.cs
Normal file
@@ -0,0 +1,89 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[ExecuteAlways]
|
||||
public class NitroxTestShowTransform : MonoBehaviour
|
||||
{
|
||||
[Header("GlobalPosition")]
|
||||
[SerializeField] private float positionX;
|
||||
[SerializeField] private float positionY;
|
||||
[SerializeField] private float positionZ;
|
||||
|
||||
[Header("GlobalRotation")]
|
||||
[SerializeField] private float rotationX;
|
||||
[SerializeField] private float rotationY;
|
||||
[SerializeField] private float rotationZ;
|
||||
[SerializeField] private float rotationW;
|
||||
|
||||
[Header("GlobalRotationEuler")]
|
||||
[SerializeField] private float rotationEulerX;
|
||||
[SerializeField] private float rotationEulerY;
|
||||
[SerializeField] private float rotationEulerZ;
|
||||
|
||||
[Header("Matrices")]
|
||||
[SerializeField] private Matrix4x4 localToWorldMatrix;
|
||||
[SerializeField] private Matrix4x4 translationMatrix;
|
||||
[SerializeField] private Matrix4x4 rotationMatrix;
|
||||
[SerializeField] private Matrix4x4 scaleMatrix;
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Vector3 position = transform.position;
|
||||
positionX = position.x;
|
||||
positionY = position.y;
|
||||
positionZ = position.z;
|
||||
|
||||
Quaternion rotation = transform.rotation;
|
||||
rotationX = rotation.x;
|
||||
rotationY = rotation.y;
|
||||
rotationZ = rotation.z;
|
||||
rotationW = rotation.w;
|
||||
|
||||
Vector3 eulerAngles = transform.eulerAngles;
|
||||
rotationEulerX = eulerAngles.x;
|
||||
rotationEulerY = eulerAngles.y;
|
||||
rotationEulerZ = eulerAngles.z;
|
||||
|
||||
localToWorldMatrix = transform.localToWorldMatrix;
|
||||
translationMatrix = Matrix4x4.Translate(transform.localPosition);
|
||||
rotationMatrix = Matrix4x4.Rotate(transform.localRotation);
|
||||
scaleMatrix = Matrix4x4.Scale(transform.localScale);
|
||||
}
|
||||
}
|
||||
|
||||
[CustomPropertyDrawer(typeof(Matrix4x4))]
|
||||
public class MatrixDrawer : PropertyDrawer
|
||||
{
|
||||
private const float CELL_WIDTH = 95f;
|
||||
private const float CELL_HEIGHT = 20f;
|
||||
|
||||
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
|
||||
{
|
||||
EditorGUI.BeginProperty(position, label, property);
|
||||
EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label);
|
||||
|
||||
position.x += 10;
|
||||
position.y += 20;
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
{
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
Rect rect = new Rect(position.x, position.y, CELL_WIDTH, CELL_HEIGHT);
|
||||
EditorGUI.PropertyField(rect, property.FindPropertyRelative("e" + i+j), GUIContent.none);
|
||||
|
||||
position.x += CELL_WIDTH;
|
||||
}
|
||||
|
||||
position.x -= CELL_WIDTH*4;
|
||||
position.y += CELL_HEIGHT;
|
||||
}
|
||||
|
||||
EditorGUI.EndProperty();
|
||||
}
|
||||
|
||||
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
|
||||
{
|
||||
return base.GetPropertyHeight(property, label) * 5 + 20;
|
||||
}
|
||||
}
|
||||
11
NitroxUnity/Assets/Editor/NitroxTestShowTransform.cs.meta
Normal file
11
NitroxUnity/Assets/Editor/NitroxTestShowTransform.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6516bbfb40c50b438666a95d714b1c8
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user