Minor - V0.1.0 - Add assets and setup the env for android handheld

This commit is contained in:
2026-02-01 23:25:01 +01:00
parent b21f1cf48b
commit 76132c2cbe
241 changed files with 189835 additions and 1350 deletions

View File

@@ -0,0 +1,81 @@
using UnityEditor;
using UnityEngine;
namespace ArcadeVP
{
[CustomEditor(typeof(ArcadeVehicleController))]
public class AVC_Editor : Editor
{
private const string DiscordUrl = "https://discord.gg/yU82FbNHcu";
private const string TutorilUrl = "https://youtu.be/2Sif8yKKl40";
private const string DocumentationUrl = "/Ash Assets/Arcade Vehicle Physics/Documentation/Documentation.pdf";
private const string RateUrl = "https://assetstore.unity.com/packages/tools/physics/arcade-vehicle-physics-193251#reviews";
private Texture2D headerBackground;
private void OnEnable()
{
// Create a white texture for the header background
headerBackground = new Texture2D(1, 1);
headerBackground.SetPixel(0, 0, Color.black);
headerBackground.Apply();
}
private void OnDisable()
{
// Destroy the texture to free up memory
DestroyImmediate(headerBackground);
}
public override void OnInspectorGUI()
{
// Define the colors
Color primaryColor = new Color(0, 1f, 0); // Green
// Create a header for the script with white background
GUIStyle headerStyle = new GUIStyle(EditorStyles.boldLabel);
headerStyle.fontSize = 27;
headerStyle.alignment = TextAnchor.MiddleCenter;
headerStyle.normal.textColor = primaryColor;
headerStyle.normal.background = headerBackground;
headerStyle.padding = new RectOffset(1, 1, 1, 1);
GUILayout.Space(10f);
GUILayout.Label("Arcade Vehicle Physics", headerStyle);
GUILayout.Space(10f);
// Create the buttons
GUIStyle buttonStyle = new GUIStyle(GUI.skin.button);
buttonStyle.normal.textColor = Color.white;
buttonStyle.fontSize = 12;
buttonStyle.alignment = TextAnchor.MiddleCenter;
buttonStyle.padding = new RectOffset(5, 5, 5, 5);
GUILayout.BeginHorizontal();
if (GUILayout.Button(new GUIContent("Join Discord", null, "Join the Discord community"), buttonStyle, GUILayout.Height(20f), GUILayout.ExpandWidth(true)))
{
Application.OpenURL(DiscordUrl);
}
if (GUILayout.Button(new GUIContent("Tutorial", null, "Watch videos on YouTube"), buttonStyle, GUILayout.Height(20f), GUILayout.ExpandWidth(true)))
{
Application.OpenURL(TutorilUrl);
}
if (GUILayout.Button(new GUIContent("Documentation", null, "Read the documentation"), buttonStyle, GUILayout.Height(20f), GUILayout.ExpandWidth(true)))
{
string doc_path = Application.dataPath + DocumentationUrl;
Application.OpenURL("file://" + doc_path);
}
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
if (GUILayout.Button(new GUIContent("Rate the Asset", null, "Rate this asset on the Unity Asset Store"), buttonStyle, GUILayout.Height(20f), GUILayout.ExpandWidth(true)))
{
Application.OpenURL(RateUrl);
}
GUILayout.EndHorizontal();
GUILayout.Space(10f);
// Display all public variables of the SimcadeVehicleController script
DrawDefaultInspector();
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: c572eea6db690a945a5a8669b00c1c01
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 193251
packageName: Arcade Vehicle Physics
packageVersion: 1.4
assetPath: Assets/Ash Assets/Arcade Vehicle Physics/Editor/AVC_Editor.cs
uploadId: 720603

View File

@@ -0,0 +1,99 @@
using UnityEditor;
using UnityEditor.Presets;
using UnityEngine;
namespace ArcadeVP
{
public class AVP_ProjectSettings : EditorWindow
{
public static bool AVP_ProjectSettings_Imported = false;
public class ImportAssetPrompt : AssetPostprocessor
{
private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
{
//Debug.Log("Asset imported: " + AVP_ProjectSettings_Imported);
if (AVP_ProjectSettings_Imported)
{
return;
}
foreach (string assetPath in importedAssets)
{
if (assetPath.Contains("Assets/Ash Assets/Arcade Vehicle Physics/Project Settings")) // Adjust to match your asset's folder
{
ShowWindow();
break;
}
//else
//{
// Debug.Log("assetPath does not Contains");
//}
}
}
}
public static void ShowWindow()
{
AVP_ProjectSettings window = GetWindow<AVP_ProjectSettings>("Import Project Settings");
window.minSize = new Vector2(300, 150);
window.Focus(); // Bring the window to the front
}
private void OnGUI()
{
GUILayout.Label("Import Project Settings", EditorStyles.boldLabel);
GUILayout.Label("Would you like to import the project settings required for Arcade Vehicle Physics?", EditorStyles.wordWrappedLabel);
GUILayout.Space(20);
if (GUILayout.Button("Yes, Import Settings"))
{
ImportProjectSettings();
AVP_ProjectSettings_Imported = true; // Mark as imported
Close();
}
if (GUILayout.Button("No, Skip"))
{
AVP_ProjectSettings_Imported = true; // Mark as imported, even if skipped
Close();
}
}
private static void ImportProjectSettings()
{
ApplyPreset("Assets/Ash Assets/Arcade Vehicle Physics/Project Settings/Input Settings Preset.preset", "ProjectSettings/InputManager.asset");
ApplyPreset("Assets/Ash Assets/Arcade Vehicle Physics/Project Settings/Physics Settings Preset.preset", "ProjectSettings/DynamicsManager.asset");
ApplyPreset("Assets/Ash Assets/Arcade Vehicle Physics/Project Settings/Tag and Layers Preset.preset", "ProjectSettings/TagManager.asset");
Debug.Log("Project settings have been successfully imported.");
}
private static void ApplyPreset(string presetPath, string settingsPath)
{
var preset = AssetDatabase.LoadAssetAtPath<Preset>(presetPath);
if (preset == null)
{
Debug.LogWarning($"Preset not found at path: {presetPath}");
return;
}
var settingsAsset = AssetDatabase.LoadAssetAtPath<Object>(settingsPath);
if (settingsAsset == null)
{
Debug.LogWarning($"Settings not found at path: {settingsPath}");
return;
}
if (preset.ApplyTo(settingsAsset))
{
Debug.Log($"Preset applied successfully to {settingsPath}");
}
else
{
Debug.LogWarning($"Failed to apply preset to {settingsPath}");
}
}
}
}

View File

@@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 609a664176f92cd45896f847b067a9f5
AssetOrigin:
serializedVersion: 1
productId: 193251
packageName: Arcade Vehicle Physics
packageVersion: 1.4
assetPath: Assets/Ash Assets/Arcade Vehicle Physics/Editor/AVP_ProjectSettings.cs
uploadId: 720603

View File

@@ -0,0 +1,324 @@
using UnityEngine;
using UnityEditor;
using System;
namespace ArcadeVP
{
public class ArcadeVehicleCreator : EditorWindow
{
ArcadeVehicleController preset;
Transform VehicleParent;
Transform wheelFL;
Transform wheelFR;
Transform wheelRL;
Transform wheelRR;
MeshRenderer bodyMesh;
MeshRenderer wheelMesh;
private GameObject NewVehicle;
private const string DiscordUrl = "https://discord.gg/yU82FbNHcu";
private const string TutorilUrl = "https://youtu.be/2Sif8yKKl40?si=ZWJkGdyLkn4o0IHl";
private const string DocumentationUrl = "/Ash Assets/Arcade Vehicle Physics/Documentation/Documentation.pdf";
private const string AshDevAssets = "https://assetstore.unity.com/publishers/52093";
[MenuItem("Tools/Arcade Vehicle Physics")]
static void OpenWindow()
{
ArcadeVehicleCreator vehicleCreatorWindow = (ArcadeVehicleCreator)GetWindow(typeof(ArcadeVehicleCreator));
vehicleCreatorWindow.minSize = new Vector2(400, 500);
vehicleCreatorWindow.Show();
}
private void OnGUI()
{
DrawHelpAndTutorialsSection();
DrawVehicleCreation();
}
private void DrawHelpAndTutorialsSection()
{
// Custom styles
var sectionStyle = new GUIStyle("Box")
{
padding = new RectOffset(10, 10, 10, 10),
margin = new RectOffset(5, 5, 5, 5)
};
var headerStyle = new GUIStyle(EditorStyles.boldLabel)
{
fontSize = 14,
alignment = TextAnchor.MiddleLeft,
normal = { textColor = new Color(0.2f, 0.6f, 1f) }
};
var buttonStyle = new GUIStyle(GUI.skin.button)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
alignment = TextAnchor.MiddleLeft,
padding = new RectOffset(35, 10, 5, 5)
};
EditorGUILayout.BeginVertical(sectionStyle);
// Header
EditorGUILayout.LabelField("Help & Tutorials", headerStyle);
EditorGUILayout.Space(5);
// First Row
EditorGUILayout.BeginHorizontal();
{
// Documentation Button
GUI.backgroundColor = new Color(0.9f, 0.9f, 0.9f);
if (GUILayout.Button(new GUIContent(" Documentation", EditorGUIUtility.IconContent("_Help").image),
buttonStyle, GUILayout.Height(28)))
{
string doc_path = Application.dataPath + DocumentationUrl;
Application.OpenURL("file://" + doc_path);
}
// Tutorial Button
GUI.backgroundColor = new Color(1f, 0.8f, 0.8f);
if (GUILayout.Button(new GUIContent(" Video Tutorials", EditorGUIUtility.IconContent("VideoPlayer Icon").image),
buttonStyle, GUILayout.Height(28)))
{
Application.OpenURL(TutorilUrl);
}
}
EditorGUILayout.EndHorizontal();
// Second Row
EditorGUILayout.BeginHorizontal();
{
// Discord Button
GUI.backgroundColor = new Color(0.8f, 0.8f, 1f);
if (GUILayout.Button(new GUIContent(" Join Discord", EditorGUIUtility.IconContent("BuildSettings.Web.Small").image),
buttonStyle, GUILayout.Height(28)))
{
Application.OpenURL(DiscordUrl);
}
// More Ash Dev Assets Button
GUI.backgroundColor = new Color(0.8f, 1f, 0.8f);
if (GUILayout.Button(new GUIContent(" Ash Dev Assets", EditorGUIUtility.IconContent("AssetStore Icon").image),
buttonStyle, GUILayout.Height(28)))
{
Application.OpenURL(AshDevAssets);
}
}
EditorGUILayout.EndHorizontal();
GUI.backgroundColor = Color.white; // Reset background color
EditorGUILayout.EndVertical();
}
private void DrawVehicleCreation()
{
// Styles
var headerStyle = new GUIStyle(EditorStyles.boldLabel)
{
fontSize = 16,
alignment = TextAnchor.MiddleLeft,
normal = { textColor = new Color(0.2f, 0.8f, 0.2f) },
margin = new RectOffset(5, 5, 10, 10)
};
var sectionStyle = new GUIStyle(EditorStyles.helpBox)
{
padding = new RectOffset(10, 10, 10, 10),
margin = new RectOffset(5, 5, 5, 5)
};
var sectionStyleFull = new GUIStyle("Box")
{
padding = new RectOffset(10, 10, 10, 10),
margin = new RectOffset(5, 5, 5, 5)
};
var buttonStyle = new GUIStyle(GUI.skin.button)
{
fontSize = 12,
fontStyle = FontStyle.Bold,
fixedHeight = 30,
margin = new RectOffset(5, 5, 8, 8)
};
EditorGUILayout.BeginVertical(sectionStyleFull);
// Main Layout
EditorGUILayout.BeginVertical();
// Title
headerStyle.alignment = TextAnchor.MiddleCenter;
EditorGUILayout.LabelField("Arcade Vehicle Creator", headerStyle);
GUI.backgroundColor = new Color(0.3f, 0.8f, 0.3f);
// Preset Section
EditorGUILayout.BeginVertical(sectionStyle);
{
preset = EditorGUILayout.ObjectField("Vehicle Preset", preset,
typeof(ArcadeVehicleController), true) as ArcadeVehicleController;
}
EditorGUILayout.EndVertical();
// Vehicle Setup Section
EditorGUILayout.BeginVertical(sectionStyle);
{
// Vehicle Parent
VehicleParent = EditorGUILayout.ObjectField("Vehicle Parent", VehicleParent,
typeof(Transform), true) as Transform;
// Wheels Group
EditorGUILayout.LabelField("Wheels", EditorStyles.boldLabel);
EditorGUI.indentLevel++;
wheelFL = EditorGUILayout.ObjectField("Front Left", wheelFL,
typeof(Transform), true) as Transform;
wheelFR = EditorGUILayout.ObjectField("Front Right", wheelFR,
typeof(Transform), true) as Transform;
wheelRL = EditorGUILayout.ObjectField("Rear Left", wheelRL,
typeof(Transform), true) as Transform;
wheelRR = EditorGUILayout.ObjectField("Rear Right", wheelRR,
typeof(Transform), true) as Transform;
EditorGUI.indentLevel--;
}
EditorGUILayout.EndVertical();
if (GUILayout.Button("Create Vehicle", buttonStyle))
{
createVehicle();
}
GUI.backgroundColor = new Color(0.3f, 0.6f, 0.9f);
// Mesh Setup Section
EditorGUILayout.BeginVertical(sectionStyle);
{
bodyMesh = EditorGUILayout.ObjectField("Body Mesh", bodyMesh,
typeof(MeshRenderer), true) as MeshRenderer;
wheelMesh = EditorGUILayout.ObjectField("Wheel Mesh", wheelMesh,
typeof(MeshRenderer), true) as MeshRenderer;
}
EditorGUILayout.EndVertical();
if (GUILayout.Button("Adjust Colliders", buttonStyle))
{
adjustColliders();
}
EditorGUILayout.EndVertical();
EditorGUILayout.EndVertical();
}
private void adjustColliders()
{
if (NewVehicle.GetComponent<BoxCollider>())
{
NewVehicle.GetComponent<BoxCollider>().center = Vector3.zero;
NewVehicle.GetComponent<BoxCollider>().size = bodyMesh.bounds.size;
}
if (NewVehicle.GetComponent<CapsuleCollider>())
{
NewVehicle.GetComponent<CapsuleCollider>().center = Vector3.zero;
NewVehicle.GetComponent<CapsuleCollider>().height = bodyMesh.bounds.size.z;
NewVehicle.GetComponent<CapsuleCollider>().radius = bodyMesh.bounds.size.x / 2;
}
Vector3 SpheareRBOffset = new Vector3(NewVehicle.transform.position.x,
wheelFL.position.y + bodyMesh.bounds.extents.y - wheelMesh.bounds.size.y / 2,
NewVehicle.transform.position.z);
NewVehicle.GetComponent<ArcadeVehicleController>().skidWidth = wheelMesh.bounds.size.x / 2;
if (NewVehicle.transform.Find("SphereRB"))
{
NewVehicle.transform.Find("SphereRB").GetComponent<SphereCollider>().radius = bodyMesh.bounds.extents.y;
NewVehicle.transform.Find("SphereRB").position = SpheareRBOffset;
}
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("Skid marks FL").position = wheelFL.position - Vector3.up * (wheelMesh.bounds.size.y / 2 - 0.02f);
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("Skid marks FR").position = wheelFR.position - Vector3.up * (wheelMesh.bounds.size.y / 2 - 0.02f);
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("Skid marks RL").position = wheelRL.position - Vector3.up * (wheelMesh.bounds.size.y / 2 - 0.02f);
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("Skid marks RR").position = wheelRR.position - Vector3.up * (wheelMesh.bounds.size.y / 2 - 0.02f);
}
private void createVehicle()
{
Make_Vehicle_Ready_For_Setup();
NewVehicle = Instantiate(preset.gameObject, bodyMesh.bounds.center, VehicleParent.rotation);
NewVehicle.name = "Arcade_" + VehicleParent.name;
GameObject.DestroyImmediate(NewVehicle.transform.Find("Mesh").Find("Body").GetChild(0).gameObject);
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFL"))
{
GameObject.DestroyImmediate(NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFL").Find("WheelFL Axel").GetChild(0).gameObject);
}
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFR"))
{
GameObject.DestroyImmediate(NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFR").Find("WheelFR Axel").GetChild(0).gameObject);
}
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRL"))
{
GameObject.DestroyImmediate(NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRL").Find("WheelRL Axel").GetChild(0).gameObject);
}
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRR"))
{
GameObject.DestroyImmediate(NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRR").Find("WheelRR Axel").GetChild(0).gameObject);
}
VehicleParent.parent = NewVehicle.transform.Find("Mesh").Find("Body");
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").position = VehicleParent.position;
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFL"))
{
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFL").position = wheelFL.position;
wheelFL.parent = NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFL").Find("WheelFL Axel");
}
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFR"))
{
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFR").position = wheelFR.position;
wheelFR.parent = NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelFR").Find("WheelFR Axel");
}
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRL"))
{
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRL").position = wheelRL.position;
wheelRL.parent = NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRL").Find("WheelRL Axel");
}
if (NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRR"))
{
NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRR").position = wheelRR.position;
wheelRR.parent = NewVehicle.transform.Find("Mesh").transform.Find("Wheels").Find("WheelRR").Find("WheelRR Axel");
}
}
private void Make_Vehicle_Ready_For_Setup()
{
var AllVehicleColliders = VehicleParent.GetComponentsInChildren<Collider>();
foreach (var collider in AllVehicleColliders)
{
DestroyImmediate(collider);
}
var AllRigidBodies = VehicleParent.GetComponentsInChildren<Rigidbody>();
foreach (var rb in AllRigidBodies)
{
DestroyImmediate(rb);
}
}
}
}

View File

@@ -0,0 +1,18 @@
fileFormatVersion: 2
guid: 87cfd02682b2dfe47b402c6f63da65ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 193251
packageName: Arcade Vehicle Physics
packageVersion: 1.4
assetPath: Assets/Ash Assets/Arcade Vehicle Physics/Editor/ArcadeVehicleCreator.cs
uploadId: 720603