Skip to content

Commit

Permalink
basic unity project code
Browse files Browse the repository at this point in the history
  • Loading branch information
mohsinkhan26 committed Jul 5, 2017
0 parents commit 52c157a
Show file tree
Hide file tree
Showing 82 changed files with 3,230 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# =============== #
# Unity generated #
# =============== #
Temp/
Obj/
UnityGenerated/
Library/

Unity Project/Assets/AssetStoreTools/
Unity Project/Assets/AssetStoreTools.meta

# ===================================== #
# Visual Studio / MonoDevelop generated #
# ===================================== #
ExportedObj/
*.svd
*.userprefs
*.csproj
*.pidb
*.suo
*.sln
*.user
*.unityproj
*.booproj

# ============ #
# OS generated #
# ============ #
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db
24 changes: 24 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
The MIT License (MIT)

Copyright (c) 2017 Mohsin Khan

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Unity Basic Project #

A boilerplate project that many games could take advantage of. As it is a basic Unity project to start with. I used some portions of it in my game projects, now writing it so that it's more usable in projects to come.

Also, It is structured properly with the namespace that it would not conflict with your code at any time.

### Module/Feature list: ###
* Singleton - generic singleton which can be used to implement managers
* MonoDirect - solution to Monobehavoiur function callbacks (called through reflections) which can be slow in most cases and could be the reason of lag
* SceneController - which should be used to switch scenes
* ReportEmail - email reporting module which allows you to mail console data to given email address
* GameLogger - allows you to log with a lot of features like color, timestamp, italics, bold etc.
* MonoExtension - includes a lot of extension methods like InvokeExtension, UpdateExtension, AlphaFade etc.
* WebAudioClip - allows you to download audio file from given URL
* WebData - allows you to download text data from given URL

### Editor Module/Feature list: ###
* Text component extension - text Id field added
* Toggle component extension - added support for Text and TextExtension to edit text of toggle, animator
* Anchors selected UI to corners
* Find gameObjects which have missing scripts
* Find nested gameObjects which have missing scripts - recursively
* Pivot set

### Usage ###
* Just download project or released plugin version
* put/import it in your project
* And start using the basic listed features

### TODO ###
* A lot to come, stay tuned

### Special Thanks ###
* All the users who point mistakes and reported issues
* All the users who provide feedback and suggestions to improve


## Thanks for your support! ##
9 changes: 9 additions & 0 deletions Unity Project/Assets/MK Assets.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Unity Project/Assets/MK Assets/Common.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Unity Project/Assets/MK Assets/Common/Editor.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Unity Project/Assets/MK Assets/Common/Editor/Extension.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
using UnityEngine.UI;

namespace UnityEditor.UI
{
[CustomEditor(typeof(TextExtension), true)]
[CanEditMultipleObjects]
public class TextExtensionEditor : TextEditor
{
SerializedProperty m_TextId;

protected override void OnEnable()
{
base.OnEnable();

m_TextId = serializedObject.FindProperty("m_textId");
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

EditorGUILayout.Space();

serializedObject.Update();
EditorGUILayout.PropertyField(m_TextId);

serializedObject.ApplyModifiedProperties();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using UnityEngine.UI;

namespace UnityEditor.UI
{
[CustomEditor(typeof(ToggleExtension), true)]
[CanEditMultipleObjects]
public class ToggleExtensionEditor : ToggleEditor
{
SerializedProperty m_Text;
SerializedProperty m_TextExtension;
SerializedProperty m_Animator;

protected override void OnEnable()
{
base.OnEnable();

m_Text = serializedObject.FindProperty("m_textComponent");
m_TextExtension = serializedObject.FindProperty("m_textExtensionComponent");
m_Animator = serializedObject.FindProperty("m_Animator");
}

public override void OnInspectorGUI()
{
base.OnInspectorGUI();

EditorGUILayout.Space();

serializedObject.Update();
EditorGUILayout.PropertyField(m_Text);
EditorGUILayout.PropertyField(m_TextExtension);
EditorGUILayout.PropertyField(m_Animator);

serializedObject.ApplyModifiedProperties();
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using UnityEditor;

namespace UnityEngine.UI.Extensions
{
public static class Anchor
{
[MenuItem("Tools/UI/Anchors to Corners")]
static void AnchorsToCorners()
{
foreach (Transform transform in Selection.transforms)
{
RectTransform t = transform as RectTransform;
RectTransform pt = Selection.activeTransform.parent as RectTransform;

if (t == null || pt == null) return;

Vector2 newAnchorsMin = new Vector2(t.anchorMin.x + t.offsetMin.x / pt.rect.width,
t.anchorMin.y + t.offsetMin.y / pt.rect.height);
Vector2 newAnchorsMax = new Vector2(t.anchorMax.x + t.offsetMax.x / pt.rect.width,
t.anchorMax.y + t.offsetMax.y / pt.rect.height);

t.anchorMin = newAnchorsMin;
t.anchorMax = newAnchorsMax;
t.offsetMin = t.offsetMax = new Vector2(0, 0);
}
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using UnityEngine;
using UnityEditor;

public class FindMissingScripts : EditorWindow
{
[MenuItem("Tools/FindMissingScripts")]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(FindMissingScripts));
}

public void OnGUI()
{
if (GUILayout.Button("Find Missing Scripts in selected prefabs"))
{
FindInSelected();
}
}

private static void FindInSelected()
{
GameObject[] go = Selection.gameObjects;
int go_count = 0, components_count = 0, missing_count = 0;
foreach (GameObject g in go)
{
go_count++;
Component[] components = g.GetComponents<Component>();
for (int i = 0; i < components.Length; i++)
{
components_count++;
if (components[i] == null)
{
missing_count++;
string s = g.name;
Transform t = g.transform;
while (t.parent != null)
{
s = t.parent.name + "/" + s;
t = t.parent;
}
Debug.Log(s + " has an empty script attached in position: " + i, g);
}
}
}

Debug.Log(string.Format("Searched {0} GameObjects, {1} components, found {2} missing", go_count, components_count, missing_count));
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 52c157a

Please sign in to comment.