├── .gitignore
├── CHANGELOG.md
├── Editor
├── BetterUnity.meta
└── BetterUnity
│ ├── Attributes.meta
│ ├── Attributes
│ ├── InspectorButton.cs
│ ├── InspectorButton.cs.meta
│ ├── InspectorTexts.cs
│ └── InspectorTexts.cs.meta
│ ├── Menu.meta
│ ├── Menu
│ ├── ContextMenus.cs
│ ├── ContextMenus.cs.meta
│ ├── ScriptableWizards.cs
│ └── ScriptableWizards.cs.meta
│ ├── Misc.meta
│ ├── Misc
│ ├── FlowControllerGUI.cs
│ └── FlowControllerGUI.cs.meta
│ ├── System.meta
│ └── System
│ ├── BetterHierarchy.cs
│ ├── BetterHierarchy.cs.meta
│ ├── BetterScene.cs
│ ├── BetterScene.cs.meta
│ ├── BetterTransform.cs
│ └── BetterTransform.cs.meta
├── LICENSE
├── README.md
├── Runtime
├── BetterUnity.meta
└── BetterUnity
│ ├── Controllers.meta
│ ├── Controllers
│ ├── FPSController.cs
│ └── FPSController.cs.meta
│ ├── DisplayFPS.cs
│ ├── DisplayFPS.cs.meta
│ ├── Experimental.meta
│ ├── Experimental
│ ├── BetterUnity.Experimental.asmdef
│ ├── BetterUnity.Experimental.asmdef.meta
│ ├── BlenderTest.cs
│ ├── BlenderTest.cs.meta
│ ├── BlenderTransform.cs
│ └── BlenderTransform.cs.meta
│ ├── Helpers.meta
│ ├── Helpers
│ ├── HelperFunctions.cs
│ ├── HelperFunctions.cs.meta
│ ├── LogToScreen.cs
│ ├── LogToScreen.cs.meta
│ ├── Serializers.meta
│ ├── Serializers
│ │ ├── Serializables.cs
│ │ └── Serializables.cs.meta
│ ├── Tidbits.meta
│ ├── Tidbits
│ │ ├── BetterRename.cs
│ │ ├── BetterRename.cs.meta
│ │ ├── BetterScale.cs
│ │ ├── BetterScale.cs.meta
│ │ ├── FreezeTransform.cs
│ │ ├── FreezeTransform.cs.meta
│ │ ├── RotationFreeze.cs
│ │ └── RotationFreeze.cs.meta
│ ├── WorldSettings.cs
│ └── WorldSettings.cs.meta
│ ├── Misc.meta
│ ├── Misc
│ ├── FlowController.cs
│ ├── FlowController.cs.meta
│ ├── LinearController.cs
│ └── LinearController.cs.meta
│ ├── Navigation System.meta
│ ├── Navigation System
│ ├── BetterUnity.NavSystem.asmdef
│ ├── BetterUnity.NavSystem.asmdef.meta
│ ├── CustomWalking.cs
│ ├── CustomWalking.cs.meta
│ ├── CustomWalkingEditor.cs
│ ├── CustomWalkingEditor.cs.meta
│ ├── Master Navigation Creator.prefab
│ ├── Master Navigation Creator.prefab.meta
│ ├── MasterNavigationCreator.cs
│ ├── MasterNavigationCreator.cs.meta
│ ├── NavigationSample.unity
│ ├── NavigationSample.unity.meta
│ ├── WalkingEnums.cs
│ └── WalkingEnums.cs.meta
│ ├── Prefabs.meta
│ ├── Prefabs
│ ├── FPS Controller.prefab
│ ├── FPS Controller.prefab.meta
│ ├── LogToScreen.prefab
│ └── LogToScreen.prefab.meta
│ ├── Scenes.meta
│ ├── Scenes
│ ├── BetterScene.meta
│ ├── BetterScene.unity
│ ├── BetterScene.unity.meta
│ ├── BetterScene
│ │ ├── BetterPP.asset
│ │ ├── BetterPP.asset.meta
│ │ ├── Materials.meta
│ │ └── Materials
│ │ │ ├── BetterSkybox.mat
│ │ │ ├── BetterSkybox.mat.meta
│ │ │ ├── DefaultGround.mat
│ │ │ ├── DefaultGround.mat.meta
│ │ │ ├── DefaultObject.mat
│ │ │ ├── DefaultObject.mat.meta
│ │ │ ├── NonBlindingWhite.mat
│ │ │ ├── NonBlindingWhite.mat.meta
│ │ │ ├── black.mat
│ │ │ └── black.mat.meta
│ ├── testScene.unity
│ └── testScene.unity.meta
│ ├── TestScripts.meta
│ ├── TestScripts
│ ├── TestScript.cs
│ ├── TestScript.cs.meta
│ ├── testui.cs
│ └── testui.cs.meta
│ ├── VR.meta
│ └── VR
│ ├── HeadLevel.cs
│ └── HeadLevel.cs.meta
├── Samples~
└── BetterScenes
│ ├── BetterScene.meta
│ ├── BetterScene.unity
│ ├── BetterScene.unity.meta
│ ├── BetterScene
│ ├── BetterPP.asset
│ ├── BetterPP.asset.meta
│ ├── Materials.meta
│ └── Materials
│ │ ├── BetterSkybox.mat
│ │ ├── BetterSkybox.mat.meta
│ │ ├── DefaultGround.mat
│ │ ├── DefaultGround.mat.meta
│ │ ├── DefaultObject.mat
│ │ ├── DefaultObject.mat.meta
│ │ ├── NonBlindingWhite.mat
│ │ ├── NonBlindingWhite.mat.meta
│ │ ├── black.mat
│ │ └── black.mat.meta
│ ├── NavigationSample.unity
│ ├── testScene.unity
│ └── testScene.unity.meta
├── betterunity.asmdef
└── package.json
/.gitignore:
--------------------------------------------------------------------------------
1 | # This .gitignore file should be placed at the root of your Unity project directory
2 | #
3 | # Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
4 | #
5 | /[Ll]ibrary/
6 | /[Tt]emp/
7 | /[Oo]bj/
8 | /[Bb]uild/
9 | /[Bb]uilds/
10 | /[Ll]ogs/
11 | /[Uu]ser[Ss]ettings/
12 | /Resources
13 |
14 | # MemoryCaptures can get excessive in size.
15 | # They also could contain extremely sensitive data
16 | /[Mm]emoryCaptures/
17 |
18 | # Recordings can get excessive in size
19 | /[Rr]ecordings/
20 |
21 | # Uncomment this line if you wish to ignore the asset store tools plugin
22 | # /[Aa]ssets/AssetStoreTools*
23 |
24 | # Autogenerated Jetbrains Rider plugin
25 | /[Aa]ssets/Plugins/Editor/JetBrains*
26 |
27 | # Visual Studio cache directory
28 | .vs/
29 |
30 | # Gradle cache directory
31 | .gradle/
32 |
33 | # packages n settings
34 | /Packages/
35 | /ProjectSettings/
36 |
37 | # Autogenerated VS/MD/Consulo solution and project files
38 | ExportedObj/
39 | .consulo/
40 | *.csproj
41 | *.unityproj
42 | *.sln
43 | *.suo
44 | *.tmp
45 | *.user
46 | *.userprefs
47 | *.pidb
48 | *.booproj
49 | *.svd
50 | *.pdb
51 | *.mdb
52 | *.opendb
53 | *.VC.db
54 |
55 | # Unity3D generated meta files
56 | *.pidb.meta
57 | *.pdb.meta
58 | *.mdb.meta
59 |
60 | # Unity3D generated file on crash reports
61 | sysinfo.txt
62 |
63 | # Builds
64 | *.apk
65 | *.aab
66 | *.unitypackage
67 | *.app
68 |
69 | # Crashlytics generated file
70 | crashlytics-build.properties
71 |
72 | # Packed Addressables
73 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
74 |
75 | # Temporary auto-generated Android Assets
76 | /[Aa]ssets/[Ss]treamingAssets/aa.meta
77 | /[Aa]ssets/[Ss]treamingAssets/aa/*
78 |
79 | # Extra Imported Assets
80 | /[Aa]ssets/[Ee]xtras
81 |
82 | /Assets/Scenes
83 |
84 | # Navigation system's testing fbx
85 | /Assets/BetterUnity/Scripts/VR/Walking.fbx
86 | /Assets/BetterUnity/Scripts/VR/Walking.anim
87 | /Assets/BetterUnity/Scripts/VR/Running.anim
88 | /Assets/BetterUnity/Scripts/VR/Ch16_1001_Normal.png
89 | /Assets/BetterUnity/Scripts/VR/Ch16_1001_Diffuse.png
90 | /Assets/BetterUnity/Scripts/VR/Ch16_1001_Glossiness.png
91 | /Assets/BetterUnity/Scripts/VR/Ch16_1001_Specular.png
92 |
93 | /Assets/BetterUnity/Scripts/VR/Ch16_1002_Normal.png
94 | /Assets/BetterUnity/Scripts/VR/Ch16_1002_Diffuse.png
95 | /Assets/BetterUnity/Scripts/VR/Ch16_1002_Glossiness.png
96 | /Assets/BetterUnity/Scripts/VR/Ch16_1002_Specular.png
97 | LICENSE.meta
98 | package.json.meta
99 | CHANGELOG.md.meta
100 | README.md.meta
101 | Runtime.meta
102 | Editor.meta
103 | BetterUnity.asmdef.meta
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Change Log:
2 |
3 | ## 0.9.2
4 | - Added BetterHierarchy.
5 | - Removed some deprecated functions.
6 | - Made proper summary for some functions.
7 |
8 | ## 0.9.1
9 | - Additions to BetterTransform (visualizers mainly and some QoL)
10 | - New Helper Functions.
11 | - Scene View now persists.
12 | - Streamlined structure and fixed some small bugs.
13 | - Added BetterDecoration.
14 |
15 | ## 0.9
16 | - Added new scriptable wizards for mesh combining abilities.
17 | - Added new Insepctor attributes.
18 | - Added a new generic select tool.
19 | - Updated the headlevel script to include various new settings for VR based element movement.
20 |
21 | ## 0.7.2
22 |
23 | - Fixed gimbal lock issues when modifying euler angles directly through the inspector.
24 |
25 | ## 0.7.1
26 |
27 | - Fixed semantics related to the samples.
28 | - Modified how BetterTransform behaves.
29 | - Added a scale slider with additional ceil functionality.
30 | - Tried to somewhat fix the assembly definitions
31 |
32 | ## 0.6.0
33 |
34 |
35 | - Undo states which persist throughout the session and hence doesn't break general undo flow when modifying objects.
36 | - Saves and persists states of some fields/properties on the inspector -- enabling easier modifications.
37 | - Added lossy scale's information on inspector.
38 | - Added a slider for the uniform scale option.
39 |
40 | ## 0.2.1
41 | - Major changes for this release, the most important being the size is now just 280kbs as opposed to the previous multiple megabytes.
42 | - Has new helper functions including neat color conversions. Has more GUI based tweaks too.
43 | - Detailed documentation inside the code as usual.
44 |
45 | ## 0.1.0
46 | - Initial release.
47 |
48 |
--------------------------------------------------------------------------------
/Editor/BetterUnity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1243cd83ead07d54384771de4a2f1948
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Attributes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 102d1ae6b911043499e42540926eff4d
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Attributes/InspectorButton.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | #if UNITY_EDITOR
3 | using UnityEditor;
4 | #endif
5 | using System.Reflection;
6 |
7 | ///
8 | /// Suceed this with a field where you specify the button's text as the variable name
9 | ///
10 | [System.AttributeUsage(System.AttributeTargets.All)]
11 | public class InspectorButtonAttribute : PropertyAttribute
12 | {
13 | public static float defaultButtonWidth = 80;
14 |
15 | public readonly string methodToBeCalled;
16 |
17 | public readonly string buttonText;
18 |
19 | public bool dynamicWidth = false;
20 |
21 | private float _buttonWidth = defaultButtonWidth;
22 | public float ButtonWidth
23 | {
24 | get { return _buttonWidth; }
25 | set { _buttonWidth = value; }
26 | }
27 |
28 | ///
29 | /// Create a inspector button with the button text being based on the suceeding variable's name.
30 | ///
31 | /// The name of the method to be called.
32 | /// Creates a button in inspector.
33 | public InspectorButtonAttribute(string methodNamePassed)
34 | {
35 | this.methodToBeCalled = methodNamePassed;
36 |
37 | this.buttonText = "";
38 |
39 | dynamicWidth = true;
40 |
41 | }
42 |
43 | ///
44 | /// Create a inspector button with the button text being based on the suceeding variable's name.
45 | ///
46 | /// The name of the method to be called.
47 | /// The width of the button, keep it greater than 80 as below that becomes too small. Pass 0 for dynamic scaling.
48 | /// Creates a button in inspector.
49 | public InspectorButtonAttribute(string methodNamePassed,float buttonWidth)
50 | {
51 | this.methodToBeCalled = methodNamePassed;
52 | this._buttonWidth = buttonWidth;
53 |
54 | this.buttonText = "";
55 |
56 | if (buttonWidth == 0)
57 | {
58 | dynamicWidth = true;
59 | }
60 | }
61 |
62 | ///
63 | /// Create a inspector button with the button text being based on the suceeding variable's name.
64 | ///
65 | /// The name of the method to be called.
66 | /// The width of the button, keep it greater than 80 as below that becomes too small. Pass 0 for dynamic scaling.
67 | /// The text inside the button [when using this, the variable name will be ignored].
68 | /// Creates a button in inspector.
69 | public InspectorButtonAttribute(string methodNamePassed, float buttonWidth, string buttonText)
70 | {
71 | this.methodToBeCalled = methodNamePassed;
72 | this._buttonWidth = buttonWidth;
73 |
74 | this.buttonText = buttonText;
75 |
76 | if (buttonWidth == 0)
77 | {
78 | dynamicWidth = true;
79 | }
80 | }
81 |
82 | ///
83 | /// Create a inspector button with the button text being based on the suceeding variable's name.
84 | ///
85 | /// The name of the method to be called.
86 | /// The width of the button, keep it greater than 80 as below that becomes too small. Pass 0 for dynamic scaling.
87 | /// The text inside the button [when using this, the variable name will be ignored].
88 | /// Creates a button in inspector.
89 | public InspectorButtonAttribute(string methodNamePassed, string buttonText)
90 | {
91 | this.methodToBeCalled = methodNamePassed;
92 |
93 |
94 | this.buttonText = buttonText;
95 |
96 |
97 | dynamicWidth = true;
98 |
99 | }
100 | }
101 |
102 | #if UNITY_EDITOR
103 | [CustomPropertyDrawer(typeof(InspectorButtonAttribute))]
104 | public class InspectorButtonPropertyDrawer : PropertyDrawer
105 | {
106 | private MethodInfo _eventMethodInfo = null;
107 |
108 | public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
109 | {
110 | InspectorButtonAttribute inspectorButtonAttribute = (InspectorButtonAttribute)attribute;
111 |
112 | string currentLabel;
113 | if (inspectorButtonAttribute.buttonText.Equals(""))
114 | currentLabel = label.text;
115 | else
116 | {
117 | currentLabel = inspectorButtonAttribute.buttonText;
118 | }
119 |
120 | if (inspectorButtonAttribute.dynamicWidth)
121 | {
122 | inspectorButtonAttribute.ButtonWidth = HelperFunctions.ScaleRange(currentLabel.Length, 1, currentLabel.Length, 80, currentLabel.Length * 8);
123 | }
124 | Rect buttonRect = new Rect(position.x + (position.width - inspectorButtonAttribute.ButtonWidth) * 0.5f, position.y, inspectorButtonAttribute.ButtonWidth, position.height);
125 | if (GUI.Button(buttonRect, currentLabel))
126 | {
127 | System.Type eventOwnerType = prop.serializedObject.targetObject.GetType();
128 | string eventName = inspectorButtonAttribute.methodToBeCalled;
129 |
130 | if (_eventMethodInfo == null)
131 | _eventMethodInfo = eventOwnerType.GetMethod(eventName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
132 |
133 | if (_eventMethodInfo != null)
134 | _eventMethodInfo.Invoke(prop.serializedObject.targetObject, null);
135 | else
136 | Debug.LogWarning(string.Format("InspectorButton: Unable to find method {0} in {1}", eventName, eventOwnerType));
137 | }
138 | }
139 | }
140 | #endif
141 |
142 | #if UNITY_EDITOR
143 | [CustomPropertyDrawer(typeof(LayerAttribute))]
144 | class LayerAttributeEditor : PropertyDrawer
145 | {
146 |
147 | public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
148 | {
149 | // One line of oxygen free code.
150 | property.intValue = EditorGUI.LayerField(position, label, property.intValue);
151 | }
152 | }
153 | #endif
154 |
155 | ///
156 | /// Attribute to select a single layer.
157 | ///
158 | public class LayerAttribute : PropertyAttribute
159 | {
160 | // NOTHING - just oxygen.
161 | }
162 |
163 |
164 | //Call in editor Unity
165 |
166 | [System.AttributeUsage(System.AttributeTargets.Method)]
167 | public class CallInEditorAttribute : PropertyAttribute
168 | {
169 |
170 | }
171 |
172 | [System.AttributeUsage(System.AttributeTargets.Field)]
173 | public class WatchAttribute : PropertyAttribute
174 | {
175 | // nothing - just oxygen innit
176 |
177 | }
178 |
179 | public class WatchAttributeClass : GUI
180 | {
181 | private void OnGUI()
182 | {
183 | GUILayout.TextArea("test");
184 | }
185 | }
186 |
187 | [CanEditMultipleObjects]
188 | [CustomEditor(typeof(MonoBehaviour), true)]
189 | public class MonoBehaviourCustomEditor : Editor
190 | {
191 | private MethodInfo _eventMethodInfo = null;
192 |
193 | public override void OnInspectorGUI()
194 | {
195 | DrawDefaultInspector(); // We wanna maintain everything else in the inspector
196 |
197 | // Similar to prop.serializedObject.targetObject.GetType() - Get the type information for our current selected MonoBehaviour script
198 | var type = target.GetType();
199 |
200 | // Fetch all functions
201 | foreach (var method in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static))
202 | {
203 |
204 | var attributes = method.GetCustomAttributes(typeof(CallInEditorAttribute), true); // check if they have our attribute
205 |
206 | if (attributes.Length > 0)
207 | {
208 | if (GUILayout.Button("Execute: " + method.Name))
209 | {
210 | System.Type eventOwnerType = type;
211 |
212 | string eventName = method.Name;
213 |
214 | _eventMethodInfo = eventOwnerType.GetMethod(eventName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
215 |
216 | if (_eventMethodInfo != null)
217 | _eventMethodInfo.Invoke(target, null);
218 | else
219 | Debug.LogWarning(string.Format("InspectorButton: Unable to find method {0} in {1}", eventName, eventOwnerType));
220 | }
221 | }
222 | }
223 | }
224 | }
225 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Attributes/InspectorButton.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5f25ba374a25af5478fb417c5864fc1c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Attributes/InspectorTexts.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.UIElements;
3 | #if UNITY_EDITOR
4 | using UnityEditor;
5 | #endif
6 | using System.Reflection;
7 | using UnityEngine.UI;
8 |
9 | ///
10 | /// Insert a simple text label in the inspector
11 | ///
12 | [System.AttributeUsage(System.AttributeTargets.All)]
13 | public class LabelAttribute : PropertyAttribute
14 | {
15 |
16 | public static float defaultButtonWidth = 80;
17 |
18 | public float textWidth = defaultButtonWidth;
19 |
20 | public string text = "";
21 |
22 | public bool leftAlign = false;
23 |
24 | ///
25 | /// Creates a simple non-editable text field in the inspector.
26 | ///
27 | /// The text to display.
28 | public LabelAttribute(string label)
29 | {
30 | this.text = label;
31 | this.textWidth = text.Length;
32 |
33 | this.leftAlign = false;
34 | }
35 |
36 | ///
37 | /// Creates a simple non-editable text field in the inspector.
38 | ///
39 | /// The text to display.
40 | /// Set true for the text to align to left.
41 | public LabelAttribute(string methodNamePassed, bool leftAlign)
42 | {
43 | this.text = methodNamePassed;
44 | this.textWidth = text.Length;
45 |
46 | this.leftAlign = leftAlign;
47 | }
48 |
49 | }
50 |
51 | ///
52 | /// Insert a better looking header into your inspector.
53 | ///
54 | [System.AttributeUsage(System.AttributeTargets.All, Inherited = true, AllowMultiple = true)]
55 | public class BetterHeaderAttribute : PropertyAttribute
56 | {
57 | public static float defaultHeaderWidth = 80;
58 | public static float defaultHeaderHeight = 80;
59 |
60 | public float textWidth = defaultHeaderWidth;
61 |
62 | public float textHeight = defaultHeaderHeight;
63 |
64 | public string text = "";
65 |
66 | public bool leftAlign = false;
67 |
68 | public bool subHeading = false;
69 |
70 | TextElement te = new TextElement();
71 |
72 | ///
73 | /// Creates a header text with the string passed.
74 | ///
75 | /// The name of the header.
76 | public BetterHeaderAttribute(string heading)
77 | {
78 | this.text = heading;
79 |
80 | this.textWidth = CalculateSizeAndReturn();
81 |
82 | this.textHeight = defaultHeaderHeight;
83 |
84 | this.leftAlign = false;
85 | }
86 |
87 | ///
88 | /// Creates a header text with the string passed.
89 | ///
90 | /// The name of the header.
91 | /// Set true for the text to align to left.
92 | public BetterHeaderAttribute(string heading, bool leftAlign)
93 | {
94 | this.text = heading;
95 |
96 | this.textWidth = CalculateSizeAndReturn();
97 |
98 | this.leftAlign = leftAlign;
99 | }
100 |
101 | ///
102 | /// Creates a header text with the string passed.
103 | ///
104 | /// The name of the header.
105 | /// Set true for the text to align to left.
106 | /// To specify a sub-heading.
107 | public BetterHeaderAttribute(string methodNamePassed, bool leftAlign, bool subHeading)
108 | {
109 | this.text = methodNamePassed;
110 |
111 | this.textWidth = CalculateSizeAndReturn();
112 |
113 | this.leftAlign = leftAlign;
114 |
115 | this.subHeading = subHeading;
116 | }
117 |
118 | float CalculateSizeAndReturn()
119 | {
120 | // a very bandaidy fix / spent a lot of time trying to look for solutions and alternatives to this.
121 | // I tried using TextElement, TextGenerator, VisualElements but nothing worked sadly. I dont like doing this but this works accurately,
122 | // and I have spent the past few hours on such a menial problem so please enlighten me if possible.
123 |
124 | // doesn't work past 130 length of a string but how wide can an inspector really be? (i did bandaid fix previously but it looks cleaner
125 | // without it so again, please enlighten me.
126 |
127 | float add;
128 | if (text.Length >= 100)
129 | add = HelperFunctions.ScaleRange((float)text.Length, 100, 160, 0.9f, 0.85f);
130 | else if (text.Length >= 25)
131 | add = HelperFunctions.ScaleRange((float)text.Length, 25, 100, 0.95f, 0.9f);
132 | else if (text.Length < 9)
133 | add = 1.25f;
134 | else
135 | add = 1;
136 |
137 | float temp = text.Length * 7 * add;
138 | return temp;
139 | }
140 | }
141 |
142 | //Declrations for Property Attributes:
143 | #region PropertyAttributesDeclarations
144 |
145 | /// Force a field to not be null by making it look red if it's somehow not assigned.
146 | [System.AttributeUsage(System.AttributeTargets.Field)]
147 | public class NullCheckAttribute : PropertyAttribute { }
148 |
149 | ///
150 | /// Used on a SerializedField surfaces the expectation that this field can remain empty.
151 | ///
152 | public class OptionalAttribute : PropertyAttribute
153 | {
154 | [System.Flags]
155 | public enum Flag
156 | {
157 | ///
158 | /// Optional Initilization
159 | ///
160 | Test = 0,
161 | ///
162 | ///test
163 | ///
164 | Test2 = 1 << 0,
165 | ///
166 | /// test
167 | ///
168 | Test3 = 1 << 1
169 | }
170 |
171 | public Flag Flags { get; private set; } = Flag.Test;
172 |
173 | public OptionalAttribute() { }
174 |
175 | public OptionalAttribute(Flag flags)
176 | {
177 | Flags = flags;
178 | }
179 | }
180 |
181 | #endregion
182 |
183 | // Custom Drawers :
184 | // ---------------
185 | // ***************
186 | // ---------------
187 |
188 | //Implementations for Property Attributes:
189 |
190 | #if UNITY_EDITOR
191 | [CustomPropertyDrawer(typeof(LabelAttribute))]
192 | public class InspectorTextPropertyDrawer : DecoratorDrawer
193 | {
194 | float extraSpaceInternal = 1.4f;
195 |
196 | public override void OnGUI(Rect position)
197 | {
198 | GUI.color = Color.white;
199 |
200 | LabelAttribute InspectorTextAttribute = (LabelAttribute)attribute;
201 |
202 | Rect buttonRect;
203 |
204 | if (InspectorTextAttribute.leftAlign)
205 | {
206 | buttonRect = new Rect(position.x, position.y, InspectorTextAttribute.textWidth, position.height + 5f);
207 | }
208 | else
209 | {
210 | buttonRect = new Rect(position.x, position.y, position.width,position.height);
211 | }
212 |
213 | //GUI.Box(buttonRect, InspectorTextAttribute.text);
214 |
215 | GUI.Label(buttonRect, InspectorTextAttribute.text);
216 |
217 | }
218 |
219 | public override float GetHeight()
220 | {
221 | return base.GetHeight() * extraSpaceInternal;
222 | }
223 | }
224 |
225 |
226 | [CustomPropertyDrawer(typeof(BetterHeaderAttribute))]
227 | public class BetterHeadAttributeDecorator : DecoratorDrawer
228 | {
229 | float supplementHeight = 2f;
230 | float extraSpaceInternal = 1.3f;
231 | public override void OnGUI(Rect position)
232 | {
233 | GUI.color = Color.white;
234 |
235 | BetterHeaderAttribute InspectorFocusTextAttribute = (BetterHeaderAttribute)attribute;
236 |
237 | Rect buttonRect;
238 |
239 | if (InspectorFocusTextAttribute.leftAlign)
240 | {
241 | buttonRect = new Rect(position.x, position.y, InspectorFocusTextAttribute.textWidth, position.height/ extraSpaceInternal + supplementHeight);
242 |
243 | }
244 | else
245 | {
246 | buttonRect = new Rect(position.x, position.y, position.width, position.height/extraSpaceInternal + supplementHeight);
247 | }
248 |
249 | GUIStyle gUIStyle = new GUIStyle(GUI.skin.box);
250 |
251 | if (InspectorFocusTextAttribute.subHeading)
252 | gUIStyle.fontStyle = FontStyle.Normal;
253 | else
254 | gUIStyle.fontStyle = FontStyle.Bold;
255 |
256 | GUI.Box(buttonRect, InspectorFocusTextAttribute.text,gUIStyle);
257 | }
258 |
259 | public override float GetHeight()
260 | {
261 | return base.GetHeight() * extraSpaceInternal;
262 | }
263 | }
264 |
265 |
266 | //Null check // Paint the field red if not assigned
267 | [CustomPropertyDrawer(typeof(NullCheckAttribute))]
268 | public class NullCheckDrawer : PropertyDrawer
269 | {
270 | public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
271 | {
272 | EditorGUI.BeginProperty(position, label, prop);
273 |
274 | if(prop.objectReferenceValue == null)
275 | {
276 | label.text = "[null] " + label.text;
277 | GUI.color = Color.red;
278 | }
279 |
280 | EditorGUI.PropertyField(position, prop, label);
281 |
282 | GUI.color = Color.white;
283 |
284 | EditorGUI.EndProperty();
285 | }
286 | }
287 |
288 | //Optional field - make the field translucent if a field is optional
289 | [CustomPropertyDrawer(typeof(OptionalAttribute))]
290 | public class OptionalLabel : PropertyDrawer
291 | {
292 | public override void OnGUI(Rect position, SerializedProperty prop, GUIContent label)
293 | {
294 | EditorGUI.BeginProperty(position, label, prop);
295 |
296 | if (prop.propertyType == SerializedPropertyType.ObjectReference)
297 | {
298 | if (prop.objectReferenceValue == null)
299 | {
300 | GUI.color = new Color(1, 1, 1, 0.45f);
301 | }
302 | else
303 | {
304 | GUI.color = new Color(1, 1, 1, 0.8f);
305 | }
306 | }
307 | else
308 | {
309 | GUI.color = new Color(1, 1, 1, 0.45f);
310 |
311 | }
312 |
313 | label.text = "(optional) " + label.text;
314 |
315 | EditorGUI.PropertyField(position, prop, label);
316 |
317 | GUI.color = Color.white;
318 |
319 | EditorGUI.EndProperty();
320 | }
321 | }
322 |
323 | #endif
324 |
325 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Attributes/InspectorTexts.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3769cee09210f554bbba6bf0aca29355
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Menu.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a1d18b0b255b4114e842cda37f606168
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Menu/ContextMenus.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 | public class ContextMenus : EditorWindow
7 | {
8 |
9 | [MenuItem("GameObject/Better Unity/Solve Import", false,-15)]
10 | static void SolveImport(MenuCommand command)
11 | {
12 | GameObject obj = (GameObject)command.context;
13 |
14 | //obj.SetActive(false);
15 |
16 | Transform[] tempArray = obj.transform.GetComponentsInChildren();
17 |
18 | for(int i = 1; i < tempArray.Length; i++)
19 | {
20 | if (!tempArray[i].GetComponent() && !tempArray[i].GetComponent())
21 | {
22 | DestroyImmediate(tempArray[i].gameObject);
23 | }
24 | }
25 | }
26 |
27 | [MenuItem("GameObject/Create Header", false, -15)]
28 | static void CreateFolder(MenuCommand command)
29 | {
30 | GameObject obj = new GameObject();
31 |
32 |
33 | obj.name = "= My Header";
34 |
35 | Undo.RegisterCreatedObjectUndo(obj, "Created a header.");
36 | }
37 |
38 | [MenuItem("GameObject/Better Unity/Move ATB",false,0)]
39 | static void MoveToTo(MenuCommand command)
40 | {
41 | if (Selection.objects.Length != 2)
42 | {
43 | Debug.LogError("Select TWO objects which you would want to move to each other. You have selected " + Selection.objects.Length + " object(s) right now.");
44 | }
45 | else
46 | {
47 | GameObject obj1 = (GameObject) Selection.objects[0];
48 | GameObject obj2 = (GameObject) Selection.objects[1];
49 |
50 | Undo.RecordObject(obj1.transform, "Original Transform of Obj1");
51 |
52 | obj1.transform.position = obj2.transform.position;
53 | }
54 | }
55 |
56 | [MenuItem("GameObject/Better Unity/Move BTA", false,0)]
57 | static void MoveToTwo(MenuCommand command)
58 | {
59 | if (Selection.objects.Length > 2)
60 | {
61 | Debug.LogError("select two objects");
62 | }
63 | else
64 | {
65 | GameObject obj1 = (GameObject)Selection.objects[0];
66 | GameObject obj2 = (GameObject)Selection.objects[1];
67 |
68 | obj2.transform.position = obj1.transform.position;
69 | }
70 | }
71 |
72 | // Add a menu item called "usual player settings" to a Rigidbody's context menu.
73 | [MenuItem("CONTEXT/Rigidbody/BetterUnity/Usual Player Settings")]
74 | static void DoubleMass(MenuCommand command)
75 | {
76 | Rigidbody body = (Rigidbody)command.context;
77 |
78 | body.constraints = RigidbodyConstraints.FreezeRotationZ | RigidbodyConstraints.FreezeRotationX;
79 |
80 | body.interpolation = RigidbodyInterpolation.Interpolate;
81 |
82 | Debug.Log("Set usual player settings of Rigidbody.");
83 | }
84 |
85 |
86 | [MenuItem("CONTEXT/AudioSource/BetterUnity/Play Source")]
87 | static void PlayAudio(MenuCommand command)
88 | {
89 | AudioSource src = (AudioSource)command.context;
90 | src.Play();
91 | //Debug.Log("Doubled Rigidbody's Mass to " + body.mass + " from Context Menu.");
92 | Debug.Log("Playing audio now.");
93 | }
94 |
95 | [MenuItem("CONTEXT/AudioSource/BetterUnity/Stop Source")]
96 | static void StopAudio(MenuCommand command)
97 | {
98 | AudioSource src = (AudioSource)command.context;
99 | src.Stop();
100 | //Debug.Log("Doubled Rigidbody's Mass to " + body.mass + " from Context Menu.");
101 | Debug.Log("Stopping audio now.");
102 | }
103 |
104 | [MenuItem("CONTEXT/AudioSource/BetterUnity/Pause this source")]
105 | static void PauseAudio(MenuCommand command)
106 | {
107 | AudioSource src = (AudioSource)command.context;
108 | src.Pause();
109 | //Debug.Log("Doubled Rigidbody's Mass to " + body.mass + " from Context Menu.");
110 | Debug.Log("Pausing audio now.");
111 | }
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Menu/ContextMenus.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 74fc70e8cf8396647a9834ac231482b8
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Menu/ScriptableWizards.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ec2ff566e54967e46ae1e4e3c8db977e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Misc.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 92b2bd09354bb2e409ce749fbb9132c6
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/Misc/FlowControllerGUI.cs:
--------------------------------------------------------------------------------
1 | // Custom editor script for FlowController
2 | using UnityEditor;
3 |
4 | [CustomEditor(typeof(FlowController))]
5 | public class FlowControllerGUI : Editor
6 | {
7 | SerializedProperty dataArrayProp;
8 | SerializedProperty selectedStringProp;
9 | SerializedProperty selectedIndexProp;
10 | SerializedProperty dontStartAutomatically;
11 | SerializedProperty startWithDelay;
12 |
13 | void OnEnable()
14 | {
15 | dataArrayProp = serializedObject.FindProperty("eventsDividedWithStoryboard");
16 | selectedStringProp = serializedObject.FindProperty("selectedString");
17 | selectedIndexProp = serializedObject.FindProperty("selectedIndex");
18 |
19 |
20 | dontStartAutomatically = serializedObject.FindProperty("dontStartAutomatically");
21 | startWithDelay = serializedObject.FindProperty("startWithDelay");
22 |
23 | UpdateSelectedIndex();
24 | }
25 |
26 | void UpdateSelectedIndex()
27 | {
28 | if (dataArrayProp.arraySize > 0)
29 | {
30 | string selectedString = selectedStringProp.stringValue;
31 | for (int i = 0; i < dataArrayProp.arraySize; i++)
32 | {
33 | SerializedProperty elementProp = dataArrayProp.GetArrayElementAtIndex(i);
34 | SerializedProperty dataStringProp = elementProp.FindPropertyRelative("phaseName");
35 | if (dataStringProp.stringValue == selectedString)
36 | {
37 | selectedIndexProp.intValue = i;
38 | return;
39 | }
40 | }
41 | }
42 | selectedIndexProp.intValue = 0;
43 | }
44 |
45 | public override void OnInspectorGUI()
46 | {
47 | serializedObject.Update();
48 |
49 | EditorGUILayout.HelpBox("This helps you schedule events - the events associated[0] is called instantly while the rest are called with a delay of 2 seconds.", MessageType.Info);
50 |
51 | EditorGUILayout.PropertyField(dataArrayProp, true);
52 |
53 | if (dataArrayProp.arraySize > 0)
54 | {
55 | string[] dataStrings = new string[dataArrayProp.arraySize];
56 | for (int i = 0; i < dataArrayProp.arraySize; i++)
57 | {
58 | SerializedProperty elementProp = dataArrayProp.GetArrayElementAtIndex(i);
59 | SerializedProperty dataStringProp = elementProp.FindPropertyRelative("phaseName");
60 | dataStrings[i] = dataStringProp.stringValue;
61 | }
62 |
63 | EditorGUILayout.Space();
64 | EditorGUILayout.LabelField("Begin the flow from:");
65 |
66 | selectedIndexProp.intValue = EditorGUILayout.Popup(selectedIndexProp.intValue, dataStrings);
67 |
68 | dontStartAutomatically.boolValue = EditorGUILayout.Toggle("Don't Start", dontStartAutomatically.boolValue);
69 |
70 | startWithDelay.floatValue = EditorGUILayout.FloatField("Start with delay?", startWithDelay.floatValue);
71 |
72 | if (selectedIndexProp.intValue >= 0 && selectedIndexProp.intValue < dataStrings.Length)
73 | {
74 | selectedStringProp.stringValue = dataStrings[selectedIndexProp.intValue];
75 | }
76 | }
77 |
78 | serializedObject.ApplyModifiedProperties();
79 | }
80 | }
--------------------------------------------------------------------------------
/Editor/BetterUnity/Misc/FlowControllerGUI.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 76ab88b312fdb07449b5de72be75e493
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/System.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 500fddaf32d443948baaf0b73618595e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/System/BetterHierarchy.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEngine;
3 |
4 | [InitializeOnLoad]
5 | public static class BetterHierarchy
6 | {
7 | private const float ToggleWidth = 14f;
8 | private const float ToggleHeight = 14f;
9 | private const float ToggleOffsetX = 26.6f;
10 | private const float defaultToggles = 40f;
11 |
12 | private static GameObject hoveredGameObject;
13 |
14 | static GameObject selectedGameObject;
15 |
16 | static BetterHierarchy()
17 | {
18 | EditorApplication.hierarchyWindowItemOnGUI += HierarchyWindowItemOnGUI;
19 | EditorApplication.hierarchyChanged += HierarchyWindowChanged;
20 | Selection.selectionChanged += OnSelectionChanged;
21 | }
22 |
23 | private static void HierarchyWindowChanged()
24 | {
25 | hoveredGameObject = null;
26 | }
27 |
28 | private static void HierarchyWindowItemOnGUI(int instanceID, Rect selectionRect)
29 | {
30 | selectionRect = DrawToggle(instanceID, selectionRect);
31 |
32 | DrawParentSelector(instanceID, selectionRect);
33 |
34 | DrawFolders(instanceID, selectionRect);
35 | }
36 |
37 | static void OnSelectionChanged()
38 | {
39 | selectedGameObject = Selection.activeGameObject;
40 | }
41 |
42 | private static Rect DrawToggle(int instanceID, Rect selectionRect)
43 | {
44 | GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
45 | if (gameObject != null)
46 | {
47 | Event e = Event.current;
48 | if (e != null && e.type == EventType.Repaint)
49 | {
50 | selectionRect = new Rect(selectionRect.x, selectionRect.y, selectionRect.width, selectionRect.height);
51 | if (new Rect(selectionRect.x - ToggleWidth - defaultToggles, selectionRect.y, selectionRect.width, selectionRect.height).Contains(e.mousePosition))
52 | {
53 | hoveredGameObject = gameObject;
54 | }
55 | else
56 | {
57 | gameObject = null;
58 | }
59 | }
60 |
61 | if (hoveredGameObject == gameObject)
62 | {
63 | // Calculate the position for the toggle box
64 | float togglePosX = selectionRect.x - ToggleOffsetX;
65 | Rect toggleRect = new Rect(togglePosX, selectionRect.y + 1, ToggleWidth, ToggleHeight);
66 |
67 | // Draw a toggle box for the hovered GameObject
68 | Color backgroundColor = GUI.backgroundColor;
69 | GUI.backgroundColor = new Color(1f, 1f, 1f, 0.3f);
70 |
71 | if (toggleRect.Contains(e.mousePosition))
72 | GUI.backgroundColor = new Color(1f, 1f, 1f, 1f);
73 |
74 |
75 | if (gameObject)
76 | gameObject.SetActive(GUI.Toggle(toggleRect, gameObject.activeSelf, ""));
77 |
78 | GUI.backgroundColor = backgroundColor;
79 | }
80 |
81 | }
82 |
83 | return selectionRect;
84 | }
85 |
86 | private static void DrawParentSelector(int instanceID, Rect selectionRect)
87 | {
88 | GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
89 |
90 | if (gameObject != null && selectedGameObject != null && selectedGameObject.transform.parent != null)
91 | {
92 | if (gameObject == selectedGameObject)
93 | {
94 | Rect buttonRect = new Rect(selectionRect);
95 | buttonRect.x = buttonRect.xMax - 60; // Draw the button at the far right
96 |
97 | // Select Parent
98 | int lengthOfTextVisible = 8;
99 | float textOpacity = 0.7f;
100 |
101 | //Included just in case the appearance of the parent select button is to be changed.
102 | GUIStyle selectParentStyle = new GUIStyle(EditorStyles.foldout);
103 |
104 | string elementName = selectedGameObject.transform.parent.name;
105 | elementName = elementName.Length > lengthOfTextVisible ? elementName.Substring(0, lengthOfTextVisible) + "..." : elementName;
106 |
107 | Color backgroundColor = GUI.backgroundColor;
108 | GUI.backgroundColor = new Color(1, 1, 1, textOpacity);
109 |
110 | if (GUI.Button(buttonRect, elementName, selectParentStyle))
111 | {
112 | Selection.activeGameObject = selectedGameObject.transform.parent.gameObject;
113 | }
114 |
115 | GUI.backgroundColor = backgroundColor;
116 | }
117 | }
118 | }
119 |
120 | private static void DrawFolders(int instanceID, Rect selectionRect)
121 | {
122 | GameObject gameObject = EditorUtility.InstanceIDToObject(instanceID) as GameObject;
123 | if (gameObject != null && gameObject.name.StartsWith("="))
124 | {
125 | bool currentlyActive = gameObject.activeInHierarchy;
126 | EditorGUI.DrawRect(selectionRect, currentlyActive ? new Color(0.15f,0.15f,0.15f,1f) : new Color(0.2f, 0.2f, 0.2f, 1f));
127 | GUIStyle style = new GUIStyle(EditorStyles.whiteLabel);
128 | style.alignment = TextAnchor.MiddleCenter;
129 | style.fontStyle = FontStyle.Bold;
130 | style.fontSize = 12; // Adjust font size as needed
131 |
132 | // Remove the preceding "= " from the name
133 | string displayName = gameObject.name.Substring(2);
134 |
135 | if (!currentlyActive)
136 | {
137 | displayName = "[~] " + displayName;
138 | style.normal.textColor = new Color(0.7f, 0.7f, 0.7f, 0.7f);
139 | }
140 |
141 | EditorGUI.LabelField(selectionRect, displayName, style);
142 | }
143 | }
144 |
145 | }
146 |
147 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/System/BetterHierarchy.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d6f7a44f4ad543643940e7fdca00e441
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/System/BetterScene.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 | public static class BetterScene
7 | {
8 | [MenuItem("BetterUnity/BetterScene/GetCameraPivot _1")]
9 | static void GetSceneCameraLocation()
10 | {
11 | Debug.Log("Teleported to position 1.");
12 | RestoreCamera(0);
13 | }
14 | [MenuItem("BetterUnity/BetterScene/SetCameraPivot %1")]
15 | static void SetSceneCameraLocation()
16 | {
17 | Debug.Log("You set the camera pivot to 1.");
18 | StoreCamera(0);
19 | }
20 |
21 | [MenuItem("BetterUnity/BetterScene/GetCameraPivot2 _2")]
22 | static void GetSceneCameraLocation2()
23 | {
24 | Debug.Log("Teleported to position 2.");
25 | RestoreCamera(1);
26 | }
27 | [MenuItem("BetterUnity/BetterScene/SetCameraPivot2 %2")]
28 | static void SetSceneCameraLocation2()
29 | {
30 | Debug.Log("You set the camera pivot to 2.");
31 | StoreCamera(1);
32 | }
33 |
34 | [MenuItem("BetterUnity/BetterScene/GetCameraPivot3 _3")]
35 | static void GetSceneCameraLocation3()
36 | {
37 | Debug.Log("Teleported to position 3.");
38 | RestoreCamera(2);
39 | }
40 | [MenuItem("BetterUnity/BetterScene/SetCameraPivot3 %3")]
41 | static void SetSceneCameraLocation3()
42 | {
43 | Debug.Log("You set the camera pivot to 3.");
44 | StoreCamera(2);
45 | }
46 |
47 |
48 | static Vector3[] Pivots = { Vector3.zero, Vector3.zero, Vector3.zero, Vector3.zero };
49 | static Quaternion[] Rotations = { Quaternion.identity, Quaternion.identity, Quaternion.identity, Quaternion.identity };
50 | static float[] Sizes = { 1f, 1f, 1f, 1f };
51 | static void StoreCamera(int index)
52 | {
53 | var scene = SceneView.lastActiveSceneView;
54 |
55 | EditorPrefs.SetString("pivot" + index, scene.pivot.ToString());
56 | Pivots[index] = scene.pivot;
57 | EditorPrefs.SetString("rotation" + index, scene.rotation.ToString());
58 | Rotations[index] = scene.rotation;
59 | EditorPrefs.SetString("size" + index, scene.size.ToString());
60 | Sizes[index] = scene.size;
61 | }
62 |
63 | static void RestoreCamera(int index)
64 | {
65 | var scene = SceneView.lastActiveSceneView;
66 |
67 | Pivots[index] = (EditorPrefs.GetString("pivot" + index,"(0.00,0.00,0.00)")).StringToVector3();
68 | Rotations[index] = (EditorPrefs.GetString("rotation" + index, "(0.00,0.00,0.00,1)")).StringToQuaternion();
69 | Sizes[index] = float.Parse(EditorPrefs.GetString("size" + index, "1f"));
70 |
71 | scene.pivot = Pivots[index];
72 | scene.rotation = Rotations[index];
73 | scene.size = Sizes[index];
74 | scene.Repaint();
75 | }
76 | }
--------------------------------------------------------------------------------
/Editor/BetterUnity/System/BetterScene.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 917950430a88a5448b44c1dbbfcce193
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/BetterUnity/System/BetterTransform.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 939dfe9777cb3b849b43d258e462ed4c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2024 Satyam Kashyap
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d26a06016e7fb7e419d12f973fc4b215
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Controllers.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 15d49b4e605c2264da478587f8309616
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Controllers/FPSController.cs:
--------------------------------------------------------------------------------
1 | //BetterUnity // First Person Controller Template
2 |
3 | //1. Attach this script to the parent GameObject. (Character, Capsule)
4 | //2. Attach a camera on a child GameObject, and assign it in the inspector.
5 |
6 |
7 | using UnityEngine;
8 |
9 | [RequireComponent(typeof(Rigidbody))]
10 | public class FPSController : MonoBehaviour
11 | {
12 | // Information in inspector
13 | [Header("")]
14 | [Header("A simple First Person controller template.")]
15 | [Header("1. Attach this script to the parent (Character, Capsule etc) GameObject. ")]
16 |
17 | [Header("2. Attach a camera on a child GameObject, and assign it below.")]
18 |
19 |
20 | [Header("")]
21 |
22 | // User inputted speed
23 | [Tooltip("Speed of movement")]
24 | [SerializeField] private float speed = 5.0f;
25 |
26 | [SerializeField] private float sprintSpeedMultiplier = 2;
27 |
28 | [Tooltip("Speed of the jump")]
29 | [SerializeField] private float jumpForce = 5.0f;
30 |
31 | private float input_x;
32 | private float input_y;
33 |
34 | private Vector3 moveVelocity_horizontal;
35 | private Vector3 moveVelocity_vertical;
36 | private Vector3 moveVelocity;
37 |
38 | private Rigidbody rb;
39 |
40 | private float mouseRotation_Y;
41 | private float mouseRotation_X;
42 |
43 | private Vector3 rotation_player;
44 | private Vector3 rotation_camera;
45 |
46 | [Tooltip("Sensitivity of looking around")]
47 | [SerializeField] private float mouseSensitivity = 3.0f;
48 |
49 | [Tooltip("The velocity of the rigidbody after which a second jump is allowed")]
50 | [SerializeField] private float jumpingAllowedOffset = 0.1f;
51 |
52 | private bool isCursorLocked = true;
53 |
54 | [Header("References")]
55 | [Tooltip("A camera attached to a child GameObject")] public Camera childCamera;
56 |
57 | private void Start()
58 | {
59 | rb = GetComponent();
60 | }
61 |
62 | public void Update()
63 | {
64 |
65 | //Fetch input and assign it to our variable
66 | input_x = Input.GetAxis("Horizontal");
67 | input_y = Input.GetAxis("Vertical");
68 |
69 | //Velocity for the movement according to the player's current position
70 | moveVelocity_horizontal = transform.right * input_x;
71 | moveVelocity_vertical = transform.forward * input_y;
72 |
73 | moveVelocity = (moveVelocity_horizontal + moveVelocity_vertical).normalized * speed; //Final normalized velocity in our desired speed.
74 |
75 | //Fetch and apply mouse movement
76 | mouseRotation_Y = Input.GetAxisRaw("Mouse X");
77 | rotation_player = new Vector3(0, mouseRotation_Y, 0) * mouseSensitivity;
78 |
79 | mouseRotation_X = Input.GetAxisRaw("Mouse Y");
80 | rotation_camera = new Vector3(mouseRotation_X, 0, 0) * mouseSensitivity;
81 |
82 | if (Input.GetKeyDown(KeyCode.LeftShift))
83 | {
84 | speed *= sprintSpeedMultiplier;
85 | }
86 |
87 | // Input for jump
88 | if (Input.GetKeyDown(KeyCode.Space))
89 | {
90 | if(rb.velocity.y > -jumpingAllowedOffset)
91 | {
92 | moveVelocity = new Vector3(moveVelocity.x, 50 * jumpForce, moveVelocity.z);
93 | //m_Rigid.AddForce(new Vector3(0, jumpSpeed, 0));
94 | }
95 | else
96 | {
97 | moveVelocity = new Vector3(moveVelocity.x, 0, moveVelocity.z);
98 | }
99 |
100 | }
101 |
102 | //Apply the velocities to our player rigidbody
103 | if (moveVelocity != Vector3.zero)
104 | {
105 | rb.MovePosition(rb.position + moveVelocity * Time.fixedDeltaTime);
106 | }
107 |
108 |
109 | if (rotation_player != Vector3.zero)
110 | {
111 | //Rotate the camera of the player
112 | rb.MoveRotation(rb.rotation * Quaternion.Euler(rotation_player));
113 | }
114 |
115 | if (childCamera != null)
116 | {
117 | //Negate the child camera rotation so that our rotation is in XY and not just a lateral rotation
118 | childCamera.transform.Rotate(-rotation_camera);
119 | }
120 |
121 | CursorBehaviour();
122 |
123 | }
124 |
125 | //Function to deal with cursor focus.
126 | private void CursorBehaviour()
127 | {
128 | if (Input.GetKeyUp(KeyCode.Escape))
129 | {
130 | isCursorLocked = false;
131 | }
132 | else if (Input.GetMouseButtonUp(0))
133 | {
134 | isCursorLocked = true;
135 | }
136 |
137 | Cursor.lockState = isCursorLocked ? CursorLockMode.Locked : CursorLockMode.None;
138 | Cursor.visible = !isCursorLocked;
139 | }
140 |
141 | }
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Controllers/FPSController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ca892250c8b2f524f8c59d779ae1238b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/DisplayFPS.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.UI;
3 |
4 | [RequireComponent(typeof(Text))]
5 | public class DisplayFPS : MonoBehaviour
6 | {
7 | private int current;
8 | private Text fpsCounter;
9 | // Start is called before the first frame update
10 | private void Awake()
11 | {
12 | fpsCounter = GetComponent();
13 | }
14 |
15 | private void Start()
16 | {
17 | InvokeRepeating(nameof(RefreshFPS), 1, 1);
18 | }
19 |
20 | void RefreshFPS()
21 | {
22 | current = (int)(1f / Time.unscaledDeltaTime);
23 | fpsCounter.text = current.ToString();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/DisplayFPS.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 89863ae480f846746a5f4f93b5293b79
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8338aac9dd174f74d809995a3b8af315
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental/BetterUnity.Experimental.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "BetterUnity.Experimental",
3 | "rootNamespace": "",
4 | "references": [],
5 | "includePlatforms": [],
6 | "excludePlatforms": [
7 | "Android",
8 | "Editor",
9 | "EmbeddedLinux",
10 | "GameCoreScarlett",
11 | "GameCoreXboxOne",
12 | "iOS",
13 | "LinuxStandalone64",
14 | "CloudRendering",
15 | "Lumin",
16 | "macOSStandalone",
17 | "PS4",
18 | "PS5",
19 | "Stadia",
20 | "Switch",
21 | "tvOS",
22 | "WSA",
23 | "WebGL",
24 | "WindowsStandalone32",
25 | "WindowsStandalone64",
26 | "XboxOne"
27 | ],
28 | "allowUnsafeCode": false,
29 | "overrideReferences": false,
30 | "precompiledReferences": [],
31 | "autoReferenced": true,
32 | "defineConstraints": [],
33 | "versionDefines": [],
34 | "noEngineReferences": false
35 | }
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental/BetterUnity.Experimental.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5ec346d49f51ed347952825a58208114
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental/BlenderTest.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class BlenderTest : MonoBehaviour
6 | {
7 | // Start is called before the first frame update
8 | void Start()
9 | {
10 |
11 | }
12 |
13 | // Update is called once per frame
14 | void Update()
15 | {
16 |
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental/BlenderTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 59db0ed3b5fa1bf48b326e3302644609
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental/BlenderTransform.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 | [CustomEditor(typeof(BlenderTest))]
7 | public class BlenderTransform : Editor
8 | {
9 | private Transform transform;
10 | //SerializedProperty lookAtPoint;
11 |
12 |
13 | void OnEnable()
14 | {
15 | //lookAtPoint = serializedObject.FindProperty("localPosition");
16 | transform = Selection.activeTransform;
17 | }
18 | void OnSceneGUI()
19 | {
20 | EditorGUILayout.LabelField("(Above this object)");
21 |
22 | Event e = Event.current;
23 | switch (e.type)
24 | {
25 | case EventType.KeyDown:
26 | {
27 | if (Event.current.keyCode == (KeyCode.A))
28 | {
29 | //do something here
30 | Debug.Log("test");
31 |
32 | // EDIT : this a the instruction to add.
33 | // You realy need it to avoid performance issues !
34 | //e.Use();
35 | // END EDIT
36 | }
37 | break;
38 | }
39 | }
40 |
41 | transform.position = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, Camera.main.nearClipPlane));
42 | }
43 |
44 |
45 |
46 | public override void OnInspectorGUI()
47 | {
48 | serializedObject.Update();
49 | //EditorGUILayout.PropertyField(lookAtPoint);
50 | serializedObject.ApplyModifiedProperties();
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Experimental/BlenderTransform.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e8d49216c1ce05b4c8522f5bfe238278
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 58786d1fe666a434484f45419d61d9dc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/HelperFunctions.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public static class HelperFunctions
6 | {
7 |
8 | ///
9 | /// Scale a value from a previous range to a new range (remap it linearly).
10 | ///
11 | /// Original range's minimum value.
12 | /// Original range's maximum value.
13 | /// New range's minimum value.
14 | /// New range's maximum value.
15 | /// The value that is to be fit into the new range.
16 | /// A float scaled to the new specfied range.
17 | public static float ScaleRange(this float OldValue, float OldMin, float OldMax, float NewMin, float NewMax)
18 | {
19 |
20 | float OldRange = (OldMax - OldMin);
21 | float NewRange = (NewMax - NewMin);
22 | float NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin;
23 |
24 | return (NewValue);
25 | }
26 |
27 | ///
28 | /// Scale a value from a previous range to a new range (remap it linearly).
29 | ///
30 | /// Original range's minimum value.
31 | /// Original range's maximum value.
32 | /// New range's minimum value.
33 | /// New range's maximum value.
34 | /// The value that is to be fit into the new range.
35 | /// A int scaled to the new specfied range.
36 | public static int ScaleRange(this int OldValue, int OldMin, int OldMax, int NewMin, int NewMax)
37 | {
38 |
39 | int OldRange = (OldMax - OldMin);
40 | int NewRange = (NewMax - NewMin);
41 | int NewValue = (((OldValue - OldMin) * NewRange) / OldRange) + NewMin;
42 |
43 | return (NewValue);
44 | }
45 |
46 | ///
47 | /// Destroy agnostic of our current play state
48 | ///
49 | /// Transform of the object to be destroyed.
50 | public static void DestroyUniversal(this Transform _transform)
51 | {
52 | if(Application.isPlaying){
53 | Object.Destroy(_transform.gameObject);
54 | }
55 | else{
56 | Object.DestroyImmediate(_transform.gameObject);
57 | }
58 | }
59 |
60 | ///
61 | /// Destroy all children of a parent.
62 | ///
63 | /// Parent transform.
64 | public static void DestroyChildren(this Transform _transform)
65 | {
66 | if(Application.isPlaying){
67 | foreach (Transform child in _transform)
68 | {
69 | Object.Destroy(child.gameObject);
70 | }
71 | }
72 | else{
73 | foreach (Transform child in _transform)
74 | {
75 | Object.DestroyImmediate(child.gameObject);
76 | }
77 | }
78 | }
79 |
80 | ///
81 | /// Parses a String to a Vector3.
82 | ///
83 | /// String to be parsed.
84 | public static Vector3 StringToVector3(this string s)
85 | {
86 | string[] temp = s.Substring(1, s.Length - 2).Split(',');
87 | return new Vector3(float.Parse(temp[0]), float.Parse(temp[1]), float.Parse(temp[2]));
88 | }
89 |
90 | public static Quaternion StringToQuaternion(this string quat)
91 | {
92 | if (quat.StartsWith("(") && quat.EndsWith(")"))
93 | {
94 | quat = quat.Substring(1, quat.Length - 2);
95 | }
96 |
97 | string[] sArray = quat.Split(',');
98 | Quaternion result = new Quaternion(
99 | float.Parse(sArray[0]),
100 | float.Parse(sArray[1]),
101 | float.Parse(sArray[2]),
102 | float.Parse(sArray[3]));
103 |
104 | return result;
105 | }
106 |
107 |
108 | ///
109 | /// Subtract one float value from x, y, z components of a Vector3.
110 | ///
111 | /// Vector to be subtracted from..
112 | /// The value to be subtracted from the Vector3.
113 | /// A new Vector3 with subtracted value.
114 | public static Vector3 MinusFloatVector3(this Vector3 vector, float f)
115 | {
116 | return new Vector3(vector.x - f, vector.y - f, vector.z - f);
117 | }
118 |
119 | ///
120 | /// Add one float value from x, y, z components of a Vector3.
121 | ///
122 | /// Vector to be added to.
123 | /// The value to be added.
124 | /// A new Vector3 with added value.
125 | public static Vector3 PlusFloatVector3(this Vector3 vector, float f)
126 | {
127 | return new Vector3(vector.x + f, vector.y + f, vector.z + f);
128 | }
129 |
130 | ///
131 | /// Add a float to the x component and return the vector3.
132 | ///
133 | /// Vector to be added to.
134 | /// The value to be added to the Vector3's x component.
135 | /// A new Vector3 with added x value.
136 | public static Vector3 PlusFloatX(this Vector3 vector, float f)
137 | {
138 | return new Vector3(vector.x + f, vector.y, vector.z);
139 | }
140 |
141 | ///
142 | /// Subtract a float to the x component and return the vector3.
143 | ///
144 | /// Vector to be subtracted from
145 | /// The value to be subtracted from the Vector3's x component.
146 | /// A new Vector3 with added x value.
147 | public static Vector3 MinusFloatX(this Vector3 vector, float f)
148 | {
149 | return new Vector3(vector.x + f, vector.y, vector.z);
150 | }
151 |
152 | // Interpolations
153 |
154 | ///
155 | /// Returns an Ease-Out interpolation between two Vector3, the float it is called from is the t time.
156 | ///
157 | /// The start value in Vector3.
158 | /// The end value in Vector3.
159 | /// A Vector3 with the required interpolation.
160 | public static Vector3 EaseOutLerp(this Vector3 start, Vector3 end, float t)
161 | {
162 | t = Mathf.Sin(t * Mathf.PI * 0.5f);
163 | return Vector3.Lerp(start, end, t);
164 | }
165 |
166 | ///
167 | /// Returns an Ease-In interpolation between two Vector3, the float it is called from is the t time.
168 | ///
169 | /// The start value in Vector3.
170 | /// The end value in Vector3.
171 | /// A Vector3 with the required interpolation.
172 | public static Vector3 EaseInLerp(this Vector3 start, Vector3 end, float t)
173 | {
174 | t = 1f - Mathf.Cos(t * Mathf.PI * 0.5f);
175 | return Vector3.Lerp(start, end, t);
176 | }
177 |
178 | ///
179 | /// Returns a Smooth Stepping interpolation between two floats.
180 | ///
181 | /// The start value in float.
182 | /// The end value in float.
183 | /// A float with the required interpolation.
184 | public static float Smoothstep(float t,float start, float end)
185 | {
186 | t = t * t * (3f - 2f * t);
187 | return Mathf.Lerp(start, end, t);
188 | }
189 |
190 |
191 |
192 | //Transform based stuff
193 |
194 |
195 | ///
196 | /// Look at but rotate only across the Y axis (say, for an enemy that needs to turn to you at all times).
197 | ///
198 | /// The point to look at.
199 | public static void LookAtY(this Transform transform, Vector3 point)
200 | {
201 | var lookPos = point - transform.position;
202 | lookPos.y = 0;
203 | var rotation = Quaternion.LookRotation(lookPos);
204 | transform.rotation = rotation;
205 | }
206 |
207 |
208 | ///
209 | /// Give back a grounded Vector3 (ignoring the Y-position).
210 | ///
211 | /// A grounded Vector3.
212 | public static Vector3 Grounded(this Vector3 vector)
213 | {
214 | return new Vector3(vector.x, 0f, vector.z);
215 | }
216 |
217 | ///
218 | /// Returns distance between two vectors but its grounded. (ignoring their Y-position during calculation).
219 | /// The destination vector.
220 | ///
221 | /// A float with the calculated distance.
222 | public static float DistanceFromGround(this Vector3 origin, Vector3 destination)
223 | {
224 | return Vector3.Distance(origin.Grounded(), destination.Grounded());
225 | }
226 |
227 |
228 | ///
229 | /// Get a random item from a list.
230 | ///
231 | /// A random item.
232 | public static T RandomItem(this IList list)
233 | {
234 | if (list.Count == 0) throw new System.IndexOutOfRangeException("Cannot select a random item from an empty list");
235 | return list[Random.Range(0, list.Count)];
236 | }
237 |
238 |
239 | //06 - July
240 | ///
241 | /// Changes a Vector3 without modifying the Y-component.
242 | /// The Vector3 from which we want the Y-Position to retain.
243 | ///
244 | /// A Vector3 with the calculated distance.
245 | public static Vector3 ExcludeY(this Vector3 currentVec, Vector3 keepYFrom)
246 | {
247 | return new Vector3(currentVec.x,keepYFrom.y,currentVec.z);
248 | }
249 |
250 | //12 - July
251 | ///
252 | /// Reset local position, rotation, scale to default values.
253 | ///
254 | /// The transform to be reset.
255 | public static void ResetLocalTransform(this Transform _transform)
256 | {
257 | _transform.localPosition = new Vector3(0, 0, 0);
258 | _transform.localRotation = Quaternion.identity;
259 | _transform.localScale = new Vector3(1, 1, 1);
260 | }
261 |
262 | ///
263 | /// Reset global position, rotation, scale to origin.
264 | /// Scale is still applied locally because applying lossy scale is stupid.
265 | ///
266 | /// The transform to be reset.
267 | public static void ResetGlobalTransform(this Transform _transform)
268 | {
269 | _transform.position = new Vector3(0, 0, 0);
270 | _transform.rotation = Quaternion.identity;
271 | Transform tempParent = _transform.parent;
272 | _transform.parent = null;
273 |
274 | _transform.localScale = new Vector3(1, 1, 1);
275 |
276 | _transform.parent = tempParent;
277 | }
278 |
279 | ///
280 | /// Return a joined string from a string array.
281 | ///
282 | /// The string array from which a string is to be consctructed.
283 | public static string UsingStringJoin(this string[] array)
284 | {
285 | return string.Join(string.Empty, array);
286 | }
287 |
288 | ///
289 | /// Convert Hexadecimal color format to RGB format that Unity supports.
290 | ///
291 | /// The hex value to be converted into color.
292 | public static Color HexColor(this Color color, string hex)
293 | {
294 | string rawStringValue = hex;
295 |
296 | if (!rawStringValue.StartsWith("#"))
297 | {
298 | rawStringValue = rawStringValue.Insert(0,"#");
299 | }
300 |
301 |
302 | Color newColor;
303 |
304 |
305 | if (ColorUtility.TryParseHtmlString(rawStringValue, out newColor))
306 | {
307 | return newColor;
308 | }
309 | else
310 | {
311 | Debug.LogWarning("Conversion from hex to rgb failed. Check your hex string being passed.");
312 | return new Color(0, 0, 0);
313 | }
314 | }
315 |
316 | public static RaycastHit BetterRaycast(this ref RaycastHit hit,Vector3 startPosition, Vector3 direction, float raycastDistance)
317 | {
318 | Physics.Raycast(startPosition, direction, out hit, raycastDistance);
319 | Debug.DrawRay(startPosition, direction * hit.distance, Color.red);
320 | return hit;
321 | }
322 |
323 | }
324 |
325 | public static class BD
326 | {
327 | static public void Log(object message)
328 | {
329 | Object[] isArray = message as Object[];
330 |
331 | if (isArray != null)
332 | {
333 | foreach (Object testA in isArray)
334 | {
335 | Debug.Log(testA);
336 | }
337 | }
338 | else
339 | {
340 | Debug.Log(message);
341 | }
342 | }
343 |
344 | static public void Log1(object var)
345 | {
346 | Debug.Log("BD Var: " + ": " + var);
347 | }
348 |
349 | static public void Log1(object var, string varName)
350 | {
351 | Debug.Log(varName + ": " + var);
352 | }
353 |
354 | static public void Log2(object var1, object var2)
355 | {
356 |
357 | Debug.Log("BD Var 1: " + var1 + "BD Var 2: " + var2);
358 | }
359 |
360 | static public void Log2(object var1, string var1Name, object var2, string var2Name)
361 | {
362 | Debug.Log(var1Name + ": " + var1 + ". " + var2Name + ": " + var2);
363 | }
364 | }
365 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/HelperFunctions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 023e83ee06eeeab4a9864b2523a33bb7
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/LogToScreen.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using System.Collections;
3 | using UnityEditor;
4 |
5 | public class LogToScreen : MonoBehaviour
6 | {
7 | [Header("Toggle")]
8 | public bool toggleWithKey = false;
9 |
10 | public KeyCode keyCode = KeyCode.Tilde;
11 |
12 | private bool showRightNow = false;
13 |
14 | [Header("Misc")]
15 |
16 | [SerializeField]
17 | Color logColor = Color.yellow;
18 |
19 | [SerializeField]
20 | private bool displayFps = true;
21 |
22 | [SerializeField]
23 | Color fpsColor = Color.blue;
24 |
25 | string tempLogString;
26 | Queue logQueue = new Queue();
27 |
28 | private GUIStyle defaultGUIStyle;
29 |
30 | private int currentFps;
31 |
32 | [SerializeField]
33 | private int removeLogsAfterTime = 6;
34 |
35 | [BetterHeader("Amount of logs after which previous ones get overwritten (-1 for unlimited)", true)]
36 | public char t;
37 |
38 | [SerializeField]
39 | private int maximumLogsAllowed = 21;
40 |
41 | [Header("Debug")]
42 | [SerializeField] bool randomLogsForTesting = false;
43 |
44 | void Start()
45 | {
46 | //Set the default style for our GUI elements
47 | defaultGUIStyle = new GUIStyle(EditorStyles.label);
48 | defaultGUIStyle.normal.textColor = Color.white; //We can multiply our elements with any color later to get our desired color
49 |
50 | if(displayFps)
51 | InvokeRepeating(nameof(RefreshFPS), 1, 1);
52 |
53 | if(randomLogsForTesting)
54 | RandomLogsForTesting();
55 |
56 | //remove debug elements after a certain time
57 | InvokeRepeating("RemoveInTime", 2, removeLogsAfterTime);
58 |
59 | //start log disabled
60 | showRightNow = false;
61 | }
62 |
63 | void RefreshFPS()
64 | {
65 | currentFps = (int)(1f / Time.unscaledDeltaTime);
66 | }
67 |
68 | private void Update()
69 | {
70 | if (Input.GetKeyDown(keyCode))
71 | {
72 | showRightNow = !showRightNow;
73 | }
74 | }
75 |
76 | void OnEnable()
77 | {
78 | Application.logMessageReceived += HandleLog;
79 | }
80 |
81 | void OnDisable()
82 | {
83 | Application.logMessageReceived -= HandleLog;
84 | }
85 |
86 | void HandleLog(string logString, string stackTrace, LogType type)
87 | {
88 | tempLogString = logString;
89 | string newString = "\n [" + type + "] " + tempLogString;
90 | logQueue.Enqueue(newString);
91 | if (type == LogType.Exception)
92 | {
93 | newString = "\n" + stackTrace;
94 | logQueue.Enqueue(newString);
95 | }
96 | tempLogString = string.Empty;
97 | foreach (string mylog in logQueue)
98 | {
99 | tempLogString += mylog;
100 | }
101 |
102 | if(maximumLogsAllowed > 0)
103 | {
104 | if (logQueue.Count > maximumLogsAllowed)
105 | {
106 | logQueue.Dequeue();
107 | }
108 | }
109 | }
110 |
111 | void LogTest()
112 | {
113 | BD.Log2(test1Counter, timer);
114 | }
115 |
116 | void OnGUI()
117 | {
118 | if (toggleWithKey)
119 | {
120 | if(showRightNow)
121 | ProcessGUI();
122 | }
123 | else
124 | {
125 | ProcessGUI();
126 | }
127 |
128 |
129 | }
130 |
131 | void ProcessGUI()
132 | {
133 | if (displayFps)
134 | GUI.contentColor = fpsColor;
135 | GUILayout.Label(" FPS: " + currentFps.ToString());
136 |
137 |
138 | GUI.contentColor = logColor;
139 |
140 | GUILayout.Label(tempLogString);
141 | }
142 |
143 | void RemoveInTime()
144 | {
145 | //Debug.Log("remove in time");
146 | if (logQueue.Count > 0)
147 | {
148 | logQueue.Dequeue();
149 | }
150 | }
151 |
152 | //IEnumerator removeInTime(string dequeue)
153 | //{
154 | // yield return new WaitForSeconds(4f);
155 | // myLogQueue.Dequeue();
156 | //}
157 |
158 | int test1Counter = 3;
159 | float timer = 4.0f;
160 |
161 | void RandomLogsForTesting()
162 | {
163 | Debug.Log("Log1");
164 | Debug.Log("Log2");
165 | Debug.Log("Log3");
166 | Debug.Log("Log4");
167 |
168 | Debug.LogError("This is an error plus time: " + Time.time);
169 |
170 | Debug.LogWarning("Warning plus position: " + transform.position);
171 |
172 | Debug.LogAssertion("Assertion plus time: " + Time.deltaTime);
173 |
174 | //a repeating function to test logging
175 | InvokeRepeating("LogTest", 1, 2);
176 |
177 |
178 |
179 | }
180 |
181 | }
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/LogToScreen.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2aba1d6c9e12c4541ab6dbe2372e7a2b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Serializers.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a6fbb052528407c48bacda035e381946
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Serializers/Serializables.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using Unity.Plastic.Newtonsoft.Json;
4 | using UnityEngine;
5 |
6 | [Serializable]
7 | public class SerializedVector3
8 | {
9 | public float x;
10 | public float y;
11 | public float z;
12 |
13 | public SerializedVector3(float x, float y, float z)
14 | {
15 | this.x = x;
16 | this.y = y;
17 | this.z = z;
18 | }
19 |
20 | public SerializedVector3(Vector3 vector3)
21 | {
22 | x = vector3.x;
23 | y = vector3.y;
24 | z = vector3.z;
25 | }
26 | }
27 |
28 | [Serializable]
29 | public class SerializedQuaternion
30 | {
31 | public float x;
32 | public float y;
33 | public float z;
34 | public float w;
35 |
36 | public SerializedQuaternion(float x, float y, float z, float w)
37 | {
38 | this.x = x;
39 | this.y = y;
40 | this.z = z;
41 | this.w = w;
42 | }
43 |
44 | public SerializedQuaternion(Quaternion quaternion)
45 | {
46 | x = quaternion.x;
47 | y = quaternion.y;
48 | z = quaternion.z;
49 | w = quaternion.w;
50 | }
51 | }
52 |
53 | public static class Vector3Extensions
54 | {
55 | public static Vector3 ToVector3(this SerializedVector3 serializedVector3)
56 | {
57 | return new Vector3(serializedVector3.x, serializedVector3.y, serializedVector3.z);
58 | }
59 |
60 | public static SerializedVector3 FromVector3(this Vector3 vector3)
61 | {
62 | return new SerializedVector3(vector3);
63 | }
64 | }
65 |
66 | public static class QuaternionExtensions
67 | {
68 | public static Quaternion ToQuaternion(this SerializedQuaternion serializedRotation)
69 | {
70 | return new Quaternion(serializedRotation.x, serializedRotation.y, serializedRotation.z, serializedRotation.w);
71 | }
72 |
73 | public static SerializedQuaternion FromQuaternion(this Quaternion quaternion)
74 | {
75 | return new SerializedQuaternion(quaternion);
76 | }
77 | }
78 |
79 | // Sample code with a general pipeline of conversions
80 |
81 | /*
82 |
83 | // Converting a Vector 3 array into serialized JSON
84 |
85 | List anchorPositions = new List();
86 | List anchorRotations = new List();
87 |
88 | foreach (var gameObjects in arrayOfGameObjects)
89 | {
90 | Vector3 currentPositionData = anchorGameObject.transform.position;
91 |
92 | Quaternion currentRotData = anchorGameObject.transform.rotation;
93 |
94 | anchorPositions.Add(Vector3Extensions.FromVector3(currentPositionData));
95 | anchorRotations.Add(QuaternionExtensions.FromQuaternion(currentRotData));
96 | }
97 |
98 | // The conversion to array is from a weird bug (that I haven't been able to reproduce but I dont want to risk it.
99 | SerializedVector3[] actualPositions = anchorPositions.ToArray();
100 | SerializedQuaternion[] actualRotations = anchorRotations.ToArray();
101 |
102 | string jsonPositions = JsonConvert.SerializeObject(actualPositions);
103 | string jsonRotations = JsonConvert.SerializeObject(actualRotations);
104 |
105 | byte[] dataPos = Encoding.ASCII.GetBytes(jsonPositions);
106 | byte[] dataRot = Encoding.ASCII.GetBytes(jsonRotations);
107 |
108 | UnityEngine.Windows.File.WriteAllBytes(localJSONPath, dataPos);
109 | UnityEngine.Windows.File.WriteAllBytes(localJSONPath, dataRot);
110 |
111 |
112 | // Converting a JSON stored array of Vector3 into a Serialized Vector3 array/list
113 |
114 | byte[] dataPos = UnityEngine.Windows.File.ReadAllBytes(localJSONPath);
115 | string jsonPos = Encoding.ASCII.GetString(dataPos);
116 |
117 | Newtonsoft.Json.Linq.JArray genericObjPos = (Newtonsoft.Json.Linq.JArray)JsonConvert.DeserializeObject(jsonPos);
118 | Debug.Log("SLWLT: " + genericObjPos);
119 |
120 | Debug.Log("SLWLT Type: " + genericObjPos.GetType());
121 |
122 | Vector3[] positions = genericObjPos.ToObject();
123 | */
124 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Serializers/Serializables.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f5db884a7a2dc7c43a861fc53266dad6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c6ad52601b80c514c87374e8b625e5b3
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/BetterRename.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [ExecuteInEditMode]
6 | public class BetterRename : MonoBehaviour
7 | {
8 | [Tooltip("Prefix to attach to every child's name.")]
9 | public string prefix;
10 | Transform[] list;
11 |
12 | [Tooltip("Children's suffix numbering will start from this number.")]
13 | public int startNumberingFrom = 0;
14 |
15 | private int currentChildCount;
16 |
17 | [InspectorButton("Reset")]
18 | public char reset;
19 |
20 | private void Awake()
21 | {
22 | FetchList();
23 | }
24 |
25 | // Update is called once per frame
26 | void Update()
27 | {
28 | if (list == null || currentChildCount != transform.childCount)
29 | {
30 | FetchList();
31 | }
32 |
33 | for (int i = 1; i < list.Length; i++)
34 | {
35 | list[i].gameObject.name = prefix + (i+startNumberingFrom-1);
36 | }
37 | }
38 |
39 | void FetchList()
40 | {
41 | list = GetComponentsInChildren();
42 | currentChildCount = transform.childCount;
43 | }
44 |
45 | void Reset()
46 | {
47 | FetchList();
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/BetterRename.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 514a4f144b1fbec41872aefa8cdf1bcf
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/BetterScale.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [ExecuteAlways]
6 | public class BetterScale : MonoBehaviour
7 | {
8 | [Tooltip("'Lock' the scaling ratio")]
9 | [SerializeField] private bool lockScale = true;
10 |
11 | private bool lockScaleInternal;
12 |
13 | private float xy;
14 | private float xz;
15 |
16 |
17 | // Update is called once per frame
18 | void Update()
19 | {
20 | if (lockScale && !lockScaleInternal)
21 | {
22 | xy = 1/(transform.localScale.x / transform.localScale.y);
23 | xz = 1/(transform.localScale.x / transform.localScale.z);
24 |
25 | lockScaleInternal = true;
26 | }
27 | else if(lockScale && lockScaleInternal)
28 | {
29 | if(transform.localScale.x/transform.localScale.y != 1/xy)
30 | transform.localScale = new Vector3(transform.localScale.x, transform.localScale.x * xy, transform.localScale.x * xz);
31 | }
32 | else if (!lockScale)
33 | {
34 | lockScaleInternal = false;
35 | }
36 |
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/BetterScale.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 40c65566692073141863921f7586d6f5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/FreezeTransform.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [ExecuteAlways]
6 | public class FreezeTransform : MonoBehaviour
7 | {
8 | public enum TransformType { GlobalTransform, LocalTransform }
9 | public enum ToFreeze { FreezeTransform, FreezePosition, FreezeRotation }
10 |
11 | public TransformType transformType;
12 | public ToFreeze toFreeze;
13 |
14 | private TransformType transformTracker;
15 | private ToFreeze toFreezeTracker;
16 |
17 | private Vector3 freezePos;
18 | private Quaternion freezeRot;
19 |
20 | private Vector3 freezeLocalPos;
21 | private Quaternion freezeLocalRot;
22 |
23 |
24 | // Start is called before the first frame update
25 | void Start()
26 | {
27 | AssignFreezeValues();
28 | }
29 |
30 | void AssignFreezeValues()
31 | {
32 | freezePos = transform.position;
33 | freezeRot = transform.rotation;
34 |
35 | freezeLocalPos = transform.localPosition;
36 | freezeLocalRot = transform.localRotation;
37 |
38 | transformTracker = transformType;
39 | toFreezeTracker = toFreeze;
40 | }
41 |
42 | // Update is called once per frame
43 | void Update()
44 | {
45 | if(transformType != transformTracker || toFreeze != toFreezeTracker)
46 | {
47 | AssignFreezeValues();
48 | }
49 |
50 | if (transformType.ToString().Equals("GlobalTransform"))
51 | {
52 | if (toFreeze.ToString().Equals("FreezeTransform"))
53 | {
54 | transform.SetPositionAndRotation(freezePos, freezeRot);
55 | }
56 | else if (toFreeze.ToString().Equals("FreezePosition"))
57 | {
58 | transform.position = freezePos;
59 | }
60 | else
61 | {
62 | transform.rotation = freezeRot;
63 | }
64 | }
65 | else
66 | {
67 | if (toFreeze.ToString().Equals("FreezeTransform"))
68 | {
69 | transform.localPosition = freezeLocalPos;
70 | transform.localRotation = freezeLocalRot;
71 | }
72 | else if (toFreeze.ToString().Equals("FreezePosition"))
73 | {
74 | transform.localPosition = freezeLocalPos;
75 | }
76 | else
77 | {
78 | transform.localRotation = freezeLocalRot;
79 | }
80 | }
81 |
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/FreezeTransform.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e2040e0f3b541704e9ec45878e18f816
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/RotationFreeze.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [ExecuteAlways]
6 | public class RotationFreeze : MonoBehaviour
7 | {
8 | [SerializeField] bool freezeX;
9 | [SerializeField] bool freezeY;
10 | [SerializeField] bool freezeZ;
11 |
12 | Quaternion rot;
13 |
14 | private void Awake()
15 | {
16 | rot = transform.rotation;
17 | }
18 |
19 |
20 | // Update is called once per frame
21 | void Update()
22 | {
23 | if (freezeX)
24 | {
25 | transform.rotation = new Quaternion(rot.x,transform.rotation.y,transform.rotation.z,transform.rotation.w);
26 | }
27 |
28 | if (freezeY)
29 | {
30 | transform.rotation = new Quaternion(transform.rotation.x, rot.y, transform.rotation.z, transform.rotation.w);
31 | }
32 |
33 | if (freezeZ)
34 | {
35 | transform.rotation = new Quaternion(transform.rotation.x, transform.rotation.y, rot.z, transform.rotation.w);
36 | }
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/Tidbits/RotationFreeze.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7eeae3a7e8144dc4c9a9e89235aa07c4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/WorldSettings.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class WorldSettings : MonoBehaviour
6 | {
7 | Transform[] all;
8 |
9 | [Header("Kill Y [kill z] Settings")]
10 |
11 | [Tooltip("The distance, below which, an object will automatically be destroyed. Akin to Unreal's KillZ")]
12 | [SerializeField] private float killY = -5000.0f;
13 |
14 | [Tooltip("The time/rate at which KillY is checked.")]
15 | [SerializeField] private int seconds = 5;
16 |
17 | [Header("Gravity Settings")]
18 |
19 | [Tooltip("Override World Gravity.")]
20 | [SerializeField] private bool overrideWorldGravity = false;
21 | [SerializeField] private float worldGravity = -1;
22 |
23 | [Header("Default Player/Camera")]
24 | //[SerializeField] private bool setDefaultGameCamera = false;
25 | [SerializeField] private Camera defaultPlayerCam;
26 |
27 |
28 | public void Awake()
29 | {
30 | transform.position = Vector3.zero;
31 |
32 | }
33 |
34 | // Start is called before the first frame update
35 | void Start()
36 | {
37 | all = GameObject.FindObjectsOfType();
38 |
39 | if(overrideWorldGravity)
40 | Physics.gravity = new Vector3(0, worldGravity, 0);
41 |
42 | if (defaultPlayerCam)
43 | defaultPlayerCam.depth = 10;
44 |
45 | InvokeRepeating("CheckForY", seconds, seconds);
46 | }
47 |
48 | // Update is called once per frame
49 | void Update()
50 | {
51 |
52 | }
53 |
54 | void CheckForY()
55 | {
56 | foreach(Transform obj in all)
57 | {
58 | if (obj != null)
59 | {
60 | if (obj.position.y < killY)
61 | {
62 | Destroy(obj.gameObject);
63 | }
64 | }
65 |
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Helpers/WorldSettings.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 74ec125c4b556fc4698e44a043c33987
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Misc.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4644e493f98f5474a80dcc044b3437fc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Misc/FlowController.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.Events;
4 |
5 | public class FlowController : MonoBehaviour
6 | {
7 | public StoryboardEvents[] eventsDividedWithStoryboard;
8 |
9 | public string selectedString;
10 |
11 | public int selectedIndex;
12 |
13 | public bool currentlyWaiting;
14 | public int currentlyWaitingForIndex;
15 |
16 | [Header("The event to start from - leave it blank to start from the beginning")]
17 | public string startFrom;
18 |
19 | public bool dontStartAutomatically;
20 |
21 | public bool[] genericSetOfBools = new bool[150];
22 |
23 | public float startWithDelay = 0.0f;
24 |
25 | // Start is called before the first frame update
26 | void Start()
27 | {
28 | genericSetOfBools = new bool[150];
29 | if (!dontStartAutomatically)
30 | {
31 | Invoke(nameof(BeginEvent),startWithDelay);
32 | }
33 | }
34 |
35 | void BeginEvent()
36 | {
37 | eventsDividedWithStoryboard[selectedIndex].eventsAssociated[0].Invoke();
38 |
39 | Debug.Log("Premature Playing: " + eventsDividedWithStoryboard[selectedIndex].phaseName);
40 | //Call waiting conditions
41 | if (eventsDividedWithStoryboard[selectedIndex].movingAheadRequirements.GetPersistentEventCount() > 0)
42 | {
43 | currentlyWaitingForIndex++;
44 |
45 | currentlyWaiting = true;
46 |
47 | eventsDividedWithStoryboard[selectedIndex].movingAheadRequirements.Invoke();
48 |
49 | Debug.Log("Playing: " + eventsDividedWithStoryboard[selectedIndex].phaseName);
50 | }
51 |
52 | //Call delayed events
53 | if (eventsDividedWithStoryboard[selectedIndex].eventsAssociated.Length > 1)
54 | {
55 |
56 | Invoke(nameof(ExecuteDelayedEventsAssociated), eventsDividedWithStoryboard[selectedIndex].lateEventDelay);
57 | }
58 |
59 | }
60 |
61 | public void ExecuteDelayedEventsAssociated()
62 | {
63 | Debug.Log("Delay executing.");
64 |
65 | eventsDividedWithStoryboard[selectedIndex].eventsAssociated[1].Invoke();
66 | }
67 |
68 | // Update is called once per frame
69 | void Update()
70 | {
71 | if (currentlyWaiting)
72 | {
73 | if (genericSetOfBools[currentlyWaitingForIndex])
74 | {
75 | selectedIndex++;
76 | BeginEvent();
77 | currentlyWaiting = false;
78 | currentlyWaitingForIndex++;
79 | }
80 | }
81 | }
82 |
83 | //waiting for the condition to turn true for something or the other
84 |
85 | //setTheBoolToBeRelatedToPressingAButton - that button press is now utilized from the set of bools
86 |
87 | //currently waiting for index is checked repeatedly in update to see if the condition has turned true
88 |
89 | //if multiple conditions make up the condition to move ahead - instead use up logical gates inside the variables you're checking to keep the bool pipeline clean
90 | public void SampleWaitCondition()
91 | {
92 | genericSetOfBools[currentlyWaitingForIndex] = false;
93 | }
94 | public void MakeGenericBoolTrue()
95 | {
96 | currentlyWaiting = true;
97 | genericSetOfBools[currentlyWaitingForIndex] = true;
98 | }
99 | }
100 |
101 | [System.Serializable]
102 | public class StoryboardEvents
103 | {
104 | [Tooltip("Name for the sake of reference and also for dictionary based searching/indexing.")]
105 | public string phaseName;
106 |
107 | [Tooltip("For the sake of reference.")]
108 | public string phaseDescription;
109 |
110 | [Tooltip("Actual events called when this event is hit.")]
111 | public UnityEvent[] eventsAssociated = new UnityEvent[2];
112 |
113 | public UnityEvent movingAheadRequirements;
114 |
115 | public float lateEventDelay = 2f;
116 |
117 | StoryboardEvents()
118 | {
119 | }
120 | }
121 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Misc/FlowController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ce65777156a5bd14ab85d12cf835ee66
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Misc/LinearController.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEngine.Events;
5 |
6 | public class LinearController : MonoBehaviour
7 | {
8 | public LinearEvents[] linearEventsToBeExecuted;
9 | // Start is called before the first frame update
10 | void Start()
11 | {
12 |
13 | }
14 |
15 | // Update is called once per frame
16 | void Update()
17 | {
18 |
19 | }
20 | }
21 |
22 |
23 | [System.Serializable]
24 | public class LinearEvents
25 | {
26 | [Tooltip("Name for the sake of reference and also for dictionary based searching/indexing.")]
27 | public string eventName;
28 |
29 | [Tooltip("Time to call the event. Can be implemented as absolute time but I prefer this as an additional way of indexing and calling the functions manually.")]
30 | public float timeToCallAt;
31 |
32 | [Tooltip("Actual events called when this event is hit.")]
33 | public UnityEvent eventsToBeCalled;
34 |
35 | LinearEvents()
36 | {
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Misc/LinearController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 93804ee8305233c4192e32a93fc2b689
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ce32076967a74494f93e4b30a09740dc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/BetterUnity.NavSystem.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "BetterUnity.NavSystem",
3 | "rootNamespace": "",
4 | "references": [],
5 | "includePlatforms": [],
6 | "excludePlatforms": [
7 | "Android",
8 | "Editor",
9 | "EmbeddedLinux",
10 | "GameCoreScarlett",
11 | "GameCoreXboxOne",
12 | "iOS",
13 | "LinuxStandalone64",
14 | "CloudRendering",
15 | "Lumin",
16 | "macOSStandalone",
17 | "PS4",
18 | "PS5",
19 | "Stadia",
20 | "Switch",
21 | "tvOS",
22 | "WSA",
23 | "WebGL",
24 | "WindowsStandalone32",
25 | "WindowsStandalone64",
26 | "XboxOne"
27 | ],
28 | "allowUnsafeCode": false,
29 | "overrideReferences": false,
30 | "precompiledReferences": [],
31 | "autoReferenced": true,
32 | "defineConstraints": [],
33 | "versionDefines": [],
34 | "noEngineReferences": false
35 | }
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/BetterUnity.NavSystem.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a6c086a0ee6108746b2a929e39948a6b
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/CustomWalking.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | public class CustomWalking : MonoBehaviour
6 | {
7 | [SerializeField] public Transform pointParent;
8 |
9 | Transform[] points;
10 |
11 | [Header("If not randomizing")]
12 | public float speed = 1.0F;
13 |
14 | [Range(0.1f, 1)]
15 | public float startTurningBodyAt = 0.5f;
16 |
17 | [Header("Deactivate when it reaches the end of the path [else it respawns]")]
18 | [SerializeField] private bool deactivateAtEnd = false;
19 |
20 | [Header("If not deactivating at end")]
21 | public int respawnStartPoint = 1;
22 | public int respawnEndPoint = 6;
23 |
24 |
25 | [Header("Randomizing Speed and settings")]
26 |
27 | [SerializeField]
28 | private bool randomizeSpeed;
29 |
30 | [SerializeField]
31 | private float randomSpeedMinimumRange = 1;
32 |
33 | [SerializeField]
34 | private float randomSpeedMaximumRange = 3;
35 |
36 |
37 | [Header("Randomizing Spawn Point [if disabled, will calculate the least distance to the nearest point]")]
38 | public bool randomizeSpawnPoints;
39 | public WalkingEnums.StartPoint startAt = WalkingEnums.StartPoint.ClosestPoint;
40 |
41 | private Transform currentStartMarker;
42 | private Transform currentEndMarker;
43 |
44 |
45 | float fractionOfJourney = 0;
46 |
47 | private Transform currentLookAtEnd;
48 |
49 |
50 | private float startTime;
51 |
52 | private float journeyLength;
53 |
54 | float distCovered;
55 |
56 | int pathIndex = 0;
57 |
58 |
59 | private Transform cachedEndForFace;
60 |
61 | private float fakeFraction = 0.5f;
62 |
63 | [Header("Lanes")]
64 | public int currentLaneWalkingOn = 1;
65 |
66 | public int numberOfLanes = 1;
67 |
68 | public float distanceBetweenLanes = 0.5f;
69 |
70 |
71 | void Start()
72 | {
73 | currentLookAtEnd = new GameObject("CurrentLookAt").transform;
74 |
75 | Transform dumper;
76 |
77 | if (GameObject.Find("Dumper") == null)
78 | {
79 | GameObject gb = new GameObject("Dumper");
80 | dumper = gb.transform;
81 | }
82 | else
83 | {
84 | dumper = GameObject.Find("Dumper").transform;
85 | }
86 |
87 | if(dumper!=null)
88 | currentLookAtEnd.parent = dumper;
89 |
90 | points = pointParent.GetComponentsInChildren();
91 |
92 | if (numberOfLanes > 1)
93 | {
94 |
95 | }
96 |
97 | startTime = Time.time;
98 |
99 | pathIndex = 0;
100 |
101 | if (randomizeSpeed)
102 | {
103 | speed = Random.Range(randomSpeedMinimumRange, randomSpeedMaximumRange);
104 | }
105 |
106 | if (startAt == WalkingEnums.StartPoint.Randomize)
107 | {
108 | pathIndex = Random.Range(1, points.Length - 3);
109 | currentStartMarker = points[pathIndex];
110 | currentEndMarker = points[pathIndex + 1];
111 | cachedEndForFace = points[pathIndex + 2];
112 | }
113 | else if(startAt == WalkingEnums.StartPoint.ClosestPoint)
114 | {
115 | //Find the closest point to start from
116 |
117 | float leastDistanceYet = 10000;
118 | int pathIndexToAssign = 1;
119 | for(int i = 1; i < points.Length - 1; i++)
120 | {
121 | float temp = Vector3.Distance(transform.position, points[i].position);
122 |
123 | if(temp < leastDistanceYet)
124 | {
125 | leastDistanceYet = Vector3.Distance(transform.position, points[i].position);
126 | pathIndexToAssign = i;
127 | }
128 | }
129 |
130 | pathIndex = pathIndexToAssign;
131 |
132 | if(pathIndex > points.Length - 3)
133 | {
134 | pathIndex -= 3;
135 | }
136 |
137 | currentStartMarker = points[pathIndex];
138 | currentEndMarker = points[pathIndex + 1];
139 | cachedEndForFace = points[pathIndex + 2];
140 | }
141 | else if(startAt == WalkingEnums.StartPoint.WalkToClosest)
142 | {
143 | //Find the closest point to start from
144 |
145 | float leastDistanceYet = 10000;
146 | int pathIndexToAssign = 1;
147 | for (int i = 1; i < points.Length - 1; i++)
148 | {
149 | float temp = Vector3.Distance(transform.position, points[i].position);
150 |
151 | if (temp < leastDistanceYet)
152 | {
153 | leastDistanceYet = Vector3.Distance(transform.position, points[i].position);
154 | pathIndexToAssign = i;
155 | }
156 | }
157 |
158 | pathIndex = pathIndexToAssign - 1;
159 |
160 | GameObject gb = new GameObject("DummyWalkClosest" + gameObject.name);
161 |
162 | if (dumper != null)
163 | {
164 | gb.transform.parent = dumper;
165 | }
166 |
167 | gb.transform.position = transform.position;
168 |
169 | currentStartMarker = gb.transform;
170 | currentEndMarker = points[pathIndex + 1];
171 | cachedEndForFace = points[pathIndex + 2];
172 |
173 | if (pathIndex > points.Length - 3)
174 | {
175 | pathIndex -= 3;
176 | }
177 | }
178 |
179 | currentLookAtEnd.position = currentEndMarker.position;
180 |
181 | journeyLength = Vector3.Distance(currentStartMarker.position, currentEndMarker.position);
182 | }
183 |
184 |
185 | void Update()
186 | {
187 | if(distCovered >= journeyLength)
188 | {
189 |
190 | pathIndex++;
191 | if (pathIndex > (points.Length - 2))
192 | {
193 | if (deactivateAtEnd)
194 | {
195 | gameObject.SetActive(false);
196 | }
197 | else
198 | {
199 | if(respawnEndPoint+1 > points.Length - 1)
200 | {
201 | respawnEndPoint = points.Length - 1;
202 | }
203 | pathIndex = Random.Range(respawnStartPoint, respawnEndPoint);
204 |
205 |
206 |
207 | currentStartMarker = points[pathIndex];
208 | currentEndMarker = points[pathIndex + 1];
209 |
210 | currentLookAtEnd.position = currentEndMarker.position;
211 | }
212 | }
213 | else
214 | {
215 | currentStartMarker = points[pathIndex];
216 | currentEndMarker = points[pathIndex + 1];
217 |
218 | currentLookAtEnd.position = currentEndMarker.position;
219 |
220 | }
221 |
222 | journeyLength = Vector3.Distance(currentStartMarker.position, currentEndMarker.position);
223 |
224 | distCovered = 0;
225 |
226 | startTime = Time.time;
227 | }
228 |
229 | distCovered = (Time.time - startTime) * speed;
230 |
231 | fractionOfJourney = distCovered / journeyLength;
232 |
233 | if(fractionOfJourney > startTurningBodyAt)
234 | {
235 | if(pathIndex + 2 < (points.Length - 1))
236 | {
237 | cachedEndForFace = points[pathIndex + 2];
238 | }
239 | else
240 | {
241 | cachedEndForFace = points[pathIndex + 1];
242 | }
243 |
244 | fakeFraction = fractionOfJourney.ScaleRange(0.5f, 1, 0, 1);
245 | //Debug.Log(fakeFraction);
246 |
247 | DoFaceLerp();
248 | }
249 |
250 | if(numberOfLanes > 1)
251 | {
252 | transform.position = Vector3.Lerp(currentStartMarker.position.PlusFloatX(distanceBetweenLanes * currentLaneWalkingOn), currentEndMarker.position.PlusFloatX(distanceBetweenLanes * currentLaneWalkingOn), fractionOfJourney);
253 | transform.LookAt(currentLookAtEnd.position.PlusFloatX(distanceBetweenLanes));
254 | }
255 | else
256 | {
257 | transform.position = Vector3.Lerp(currentStartMarker.position, currentEndMarker.position, fractionOfJourney);
258 | transform.LookAt(currentLookAtEnd);
259 | }
260 |
261 |
262 |
263 | }
264 |
265 | void DoFaceLerp()
266 | {
267 | currentLookAtEnd.position = HelperFunctions.EaseInLerp(currentLookAtEnd.position, cachedEndForFace.position, fakeFraction);
268 | }
269 | }
270 |
271 |
272 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/CustomWalking.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 17ec43ce720ad6b48814932a2031c489
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/CustomWalkingEditor.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 |
6 | //[CustomEditor(typeof(CustomWalking)), CanEditMultipleObjects]
7 | public class CustomWalkingEditor : Editor
8 | {
9 | // Colors and all
10 | private GUIStyle white;
11 |
12 | private SerializedObject m_object;
13 | private SerializedProperty pointParent;
14 |
15 | private SerializedProperty randomizeSpeed;
16 | private SerializedProperty randomizeSpawnPoints;
17 |
18 | private Transform transform;
19 |
20 | private int startIndex;
21 |
22 |
23 | #pragma warning disable IDE0052 // Remove unread private members
24 | private bool randomizeMasterBool;
25 | #pragma warning restore IDE0052 // Remove unread private members
26 |
27 | // Scale Thingies
28 | private bool lockScaleInternal;
29 |
30 | private float xy;
31 | private float xz;
32 |
33 | GenericMenu menu_visibility;
34 | GenericMenu menu_reset;
35 | GenericMenu menu_freeze;
36 |
37 | private bool[] freezeArray = new bool[6];
38 |
39 | private void OnEnable()
40 | {
41 |
42 | m_object = new SerializedObject(target);
43 |
44 | pointParent = m_object.FindProperty("pointParent");
45 | randomizeSpeed = m_object.FindProperty("randomizeSpeed");
46 | randomizeSpawnPoints = m_object.FindProperty("randomizeSpawnPoints");
47 |
48 | transform = Selection.activeTransform;
49 |
50 | randomizeMasterBool = false;
51 |
52 | menu_reset = new GenericMenu();
53 | menu_reset.AddItem(new GUIContent("Randomize Everything"), false, RandomizeToggles, 1);
54 | menu_reset.AddItem(new GUIContent("Randomize Speed"), false, RandomizeToggles, 2);
55 | menu_reset.AddItem(new GUIContent("Randomize Spawn Points"), false, RandomizeToggles, 3);
56 |
57 | menu_freeze = new GenericMenu();
58 |
59 | for (int i = 0; i < 6; i++)
60 | {
61 | freezeArray[i] = false;
62 | }
63 | }
64 |
65 | void RandomizeToggles(object parameter)
66 | {
67 | switch (parameter)
68 | {
69 | case 1:
70 | //
71 | break;
72 | case 2:
73 | transform.localRotation = Quaternion.identity;
74 | break;
75 | case 3:
76 | randomizeMasterBool = false;
77 | transform.localScale = new Vector3(1, 1, 1);
78 | break;
79 | }
80 | }
81 |
82 |
83 | public override void OnInspectorGUI()
84 | {
85 | if (m_object != null)
86 | {
87 | m_object.Update();
88 |
89 | EditorGUILayout.HelpBox(new GUIContent("The parent containing the path of points to follow in order"));
90 | // EditorGUILayout.Popup(0,new string[3] { " lolol", "safdsf", "sds" });
91 | //EditorGUILayout.GradientField(new Gradient()); // make a script to quickly modify the gradient of a new gameobject
92 |
93 |
94 | EditorGUILayout.PropertyField(pointParent, new GUIContent("Points Parent", "Position of the GameObject"));
95 |
96 | EditorGUILayout.PropertyField(randomizeSpeed, new GUIContent("Randomize Speed"));
97 |
98 | EditorGUILayout.PropertyField(randomizeSpawnPoints, new GUIContent("Randomize Spawn Points"));
99 |
100 |
101 | EditorGUILayout.Separator();
102 |
103 | EditorGUILayout.HelpBox(new GUIContent("Tools"));
104 |
105 | if (EditorGUILayout.DropdownButton(new GUIContent("Randomization Settings"), FocusType.Keyboard))
106 | {
107 | menu_reset.ShowAsContext();
108 | }
109 |
110 | m_object.ApplyModifiedProperties();
111 |
112 | }
113 |
114 | }
115 | }
116 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/CustomWalkingEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 696ca084ab0d5f5438e07cdf7a61a792
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/Master Navigation Creator.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 205cca0b0d0ac0b4e93b500ebfc256c5
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/MasterNavigationCreator.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEditor;
5 | using UnityEditor.Animations;
6 |
7 | public class MasterNavigationCreator : MonoBehaviour
8 | {
9 | [Header("General Settings // Creation | Non-Variables")]
10 | [SerializeField] int amountOfPoints = 6;
11 |
12 | [SerializeField] int amountOfPeople = 6;
13 |
14 |
15 | [InspectorFocusText("Variables (can be updated)",true)]
16 |
17 | [Tooltip("The number of lanes in our outlined path to walk on.")]
18 | [SerializeField] int numberOfLanes = 1;
19 | [SerializeField] float distanceBetweenLanes = 0.5f;
20 | [Tooltip("Randomly choose a lane everytime you play.")]
21 |
22 | [SerializeField] bool randomlyAssignLane = false;
23 |
24 | [Header("The startpoint for the characters")]
25 | [SerializeField] WalkingEnums.StartPoint startPoint;
26 |
27 | [SerializeField] GameObject[] characters;
28 |
29 | public enum AnimationState { Walking, Running }
30 |
31 | [SerializeField]
32 | private AnimationState currentAnimationState;
33 |
34 | [Header("Will start looking at the new target when they are how much through the current two points' journey (0.0-1.0)")]
35 | [Range(0.2f, 1f)]
36 | public float startTurningBodyAt = 0.7f;
37 |
38 | [Header("Make sure the gameobject is empty because it will destroy everything below it.")]
39 | [InspectorButton("CreateNavigationSystem", 0)]
40 | public char createNavigationSystem;
41 |
42 | [InspectorButton("RandomizePoints", 0)]
43 | public char randomizePoints;
44 |
45 | [Header("Press again, if the previous existing system doesnt all clear at once")]
46 | [InspectorButton("CleanUp", 0)]
47 | public char cleanUpObject;
48 |
49 | [Header("Use this to update any variable changes without disturbing already placed paths/people")]
50 | [InspectorButton("UpdateVariables", 0)]
51 | public char updateVariables;
52 |
53 | [Tooltip("All variable changes will be reflected automatically.")]
54 | [SerializeField] private bool updateAutomatically = false;
55 |
56 | GameObject pointsParent;
57 | GameObject peopleParent;
58 |
59 | private Transform[] points;
60 |
61 |
62 | [Header("editor prettiness")]
63 | [SerializeField] private Color pathColor = Color.red;
64 | [SerializeField] private Color individualPointsColor = Color.white;
65 |
66 | //34
67 |
68 | // Start is called before the first frame update
69 | void Start()
70 | {
71 |
72 | }
73 |
74 |
75 | void CreateNavigationSystem()
76 | {
77 | transform.DestroyChildren();
78 |
79 | pointsParent = new GameObject("PointsParent");
80 | peopleParent = new GameObject("PeopleParent");
81 |
82 | pointsParent.transform.parent = transform;
83 | peopleParent.transform.parent = transform;
84 |
85 | pointsParent.transform.ResetLocalTransform();
86 | peopleParent.transform.ResetLocalTransform();
87 |
88 | pointsParent.AddComponent();
89 | pointsParent.GetComponent().prefix = "p";
90 | pointsParent.GetComponent().startNumberingFrom = 1;
91 |
92 | for(int i = 0; i < amountOfPoints; i++)
93 | {
94 | GameObject gb = new GameObject();
95 |
96 | gb.transform.parent = pointsParent.transform;
97 |
98 | gb.transform.ResetLocalTransform();
99 |
100 | gb.transform.localPosition = new Vector3(gb.transform.localPosition.x + Random.Range(-25, 25f),gb.transform.localPosition.y,gb.transform.localPosition.z + Random.Range(-25, 25f));
101 | }
102 |
103 | //spawn people
104 | for (int i = 0; i < amountOfPeople; i++)
105 | {
106 |
107 | GameObject gb = Instantiate(characters[Random.Range(0, characters.Length - 1)]);
108 |
109 | gb.transform.parent = peopleParent.transform;
110 |
111 | gb.transform.ResetLocalTransform();
112 |
113 | gb.transform.localPosition = new Vector3(gb.transform.localPosition.x + Random.Range(-25, 25f), gb.transform.localPosition.y, gb.transform.localPosition.z + Random.Range(-25, 25f));
114 |
115 | gb.AddComponent();
116 |
117 | CustomWalking currentCW = gb.GetComponent();
118 |
119 | currentCW.startAt = startPoint;
120 |
121 | //Animation thingies / beautiful code btw satyam, whoa
122 |
123 | Animator animator = gb.GetComponent();
124 |
125 | if (animator == null)
126 | Debug.LogError("Please make sure your prefab has an animator attached to it with proper animation states.");
127 |
128 | var controller = (AnimatorController)animator.runtimeAnimatorController;
129 |
130 | var newState = controller.layers[0].stateMachine.defaultState;
131 |
132 | AnimationClip currentClip = null;
133 |
134 | foreach (AnimationClip clip in controller.animationClips)
135 | {
136 | if (clip.name == currentAnimationState.ToString())
137 | {
138 | currentClip = clip;
139 | controller.SetStateEffectiveMotion(newState, currentClip);
140 | }
141 | }
142 |
143 | currentCW.speed = currentAnimationState == AnimationState.Walking ? 1 : 2;
144 |
145 | if (currentClip == null)
146 | {
147 | Debug.LogError("Animation: " + currentAnimationState.ToString() + " doesnt exist in your people Animator. Please make sure it exists as a state [Remember, the clip name matters. Not the state name].");
148 | }
149 |
150 | //Animation Thingies end here
151 |
152 | //--------------------
153 |
154 | //Lane thingies start here
155 | currentCW.numberOfLanes = numberOfLanes;
156 |
157 | if(randomlyAssignLane)
158 | currentCW.currentLaneWalkingOn = Random.Range(0, numberOfLanes);
159 | currentCW.distanceBetweenLanes = distanceBetweenLanes;
160 |
161 | currentCW.startTurningBodyAt = startTurningBodyAt;
162 |
163 | currentCW.pointParent = pointsParent.transform;
164 | }
165 | }
166 |
167 | void UpdateVariables()
168 | {
169 | if(transform.childCount > 0)
170 | {
171 | pointsParent = transform.GetChild(0).gameObject;
172 | peopleParent = transform.GetChild(1).gameObject;
173 | //spawn people
174 | for (int i = 0; i < peopleParent.transform.childCount; i++)
175 | {
176 | GameObject gb = peopleParent.transform.GetChild(i).gameObject;
177 |
178 | CustomWalking currentCW = gb.GetComponent();
179 |
180 | currentCW.startAt = startPoint;
181 |
182 | //Animation thingies / beautiful code btw satyam, whoa
183 | Animator animator = gb.GetComponent();
184 |
185 | var controller = (AnimatorController)animator.runtimeAnimatorController;
186 |
187 | var newState = controller.layers[0].stateMachine.defaultState;
188 |
189 | AnimationClip currentClip = null;
190 |
191 | foreach (AnimationClip clip in controller.animationClips)
192 | {
193 | if (clip.name == currentAnimationState.ToString())
194 | {
195 | currentClip = clip;
196 | controller.SetStateEffectiveMotion(newState, currentClip);
197 | }
198 | }
199 |
200 | currentCW.speed = currentAnimationState == AnimationState.Walking ? 1 : 2;
201 |
202 | if (currentClip == null)
203 | {
204 | Debug.LogError("Animation: " + currentAnimationState.ToString() + " doesnt exist in your people Animator. Please make sure it exists as a state [Remember, the clip name matters. Not the state name].");
205 | }
206 |
207 | currentCW.numberOfLanes = numberOfLanes;
208 |
209 | if (randomlyAssignLane)
210 | currentCW.currentLaneWalkingOn = Random.Range(0, numberOfLanes);
211 |
212 | currentCW.distanceBetweenLanes = distanceBetweenLanes;
213 |
214 | currentCW.startTurningBodyAt = startTurningBodyAt;
215 |
216 | currentCW.pointParent = pointsParent.transform;
217 | }
218 | }
219 |
220 | }
221 |
222 | private void OnDrawGizmos()
223 | {
224 | Gizmos.color = individualPointsColor;
225 |
226 | if (pointsParent != null)
227 | {
228 | foreach (Transform child in pointsParent.transform)
229 | {
230 | Handles.Label(child.position, child.gameObject.name);
231 | Gizmos.DrawWireSphere(child.position, 0.6f);
232 | }
233 |
234 | Gizmos.color = pathColor;
235 | points = pointsParent.GetComponentsInChildren();
236 |
237 |
238 | for (int i = 0; i < points.Length; i++)
239 | {
240 | if ((i + 1) < points.Length && i != 0)
241 | {
242 | if (numberOfLanes > 1)
243 | {
244 | Gizmos.DrawLine(points[i].position, points[i + 1].position);
245 |
246 | for(int j = 1; j < numberOfLanes; j++)
247 | {
248 | Gizmos.DrawLine(points[i].position.PlusFloatX(distanceBetweenLanes * j), points[i + 1].position.PlusFloatX(distanceBetweenLanes * j));
249 | }
250 |
251 | }
252 | else
253 | {
254 | Gizmos.DrawLine(points[i].position, points[i + 1].position);
255 | }
256 | }
257 |
258 | }
259 |
260 | }
261 |
262 | }
263 |
264 | private void OnValidate()
265 | {
266 | if (updateAutomatically)
267 | {
268 | UpdateVariables();
269 | }
270 | }
271 |
272 | private void OnDrawGizmosSelected()
273 | {
274 | if(pointsParent == null || peopleParent == null)
275 | {
276 | if (transform.childCount > 1)
277 | {
278 | pointsParent = transform.GetChild(0).gameObject;
279 | peopleParent = transform.GetChild(1).gameObject;
280 | }
281 | }
282 | }
283 |
284 | void CleanUp()
285 | {
286 | transform.DestroyChildren();
287 | }
288 |
289 | void RandomizePoints()
290 | {
291 | if(transform.childCount > 0)
292 | {
293 | if(pointsParent == null)
294 | {
295 | pointsParent = transform.GetChild(0).gameObject;
296 | }
297 |
298 | foreach (Transform child in pointsParent.transform)
299 | {
300 | child.transform.localPosition = new Vector3(Random.Range(-25, 25f), child.transform.localPosition.y, Random.Range(-25, 25f));
301 | }
302 | }
303 | else
304 | {
305 | Debug.LogError("Make sure the points and people exist as children");
306 | }
307 | }
308 | }
309 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/MasterNavigationCreator.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 18ef744dedc9e8c45b70a77cccb70a40
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/NavigationSample.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e36dee2fc32ea3b4d8af6a510fb61cb3
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/WalkingEnums.cs:
--------------------------------------------------------------------------------
1 |
2 | public static class WalkingEnums
3 | {
4 | public enum StartPoint { Randomize, ClosestPoint, WalkToClosest }
5 | public enum AnimationStateEnums { Walking, Running }
6 | }
7 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Navigation System/WalkingEnums.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 40ab5b2e885d599459aa496f3c31ea86
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Prefabs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e290c3584bdd4b34ca6b6de3c99d73b1
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Prefabs/FPS Controller.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &2663777309796444311
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | serializedVersion: 6
10 | m_Component:
11 | - component: {fileID: 2663777309796444308}
12 | - component: {fileID: 2663777309796444306}
13 | - component: {fileID: 2663777309796444309}
14 | m_Layer: 0
15 | m_Name: Camera
16 | m_TagString: Untagged
17 | m_Icon: {fileID: 0}
18 | m_NavMeshLayer: 0
19 | m_StaticEditorFlags: 0
20 | m_IsActive: 1
21 | --- !u!4 &2663777309796444308
22 | Transform:
23 | m_ObjectHideFlags: 0
24 | m_CorrespondingSourceObject: {fileID: 0}
25 | m_PrefabInstance: {fileID: 0}
26 | m_PrefabAsset: {fileID: 0}
27 | m_GameObject: {fileID: 2663777309796444311}
28 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
29 | m_LocalPosition: {x: 0, y: 0, z: 0}
30 | m_LocalScale: {x: 1, y: 1, z: 1}
31 | m_Children: []
32 | m_Father: {fileID: 2663777310075298500}
33 | m_RootOrder: 0
34 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
35 | --- !u!20 &2663777309796444306
36 | Camera:
37 | m_ObjectHideFlags: 0
38 | m_CorrespondingSourceObject: {fileID: 0}
39 | m_PrefabInstance: {fileID: 0}
40 | m_PrefabAsset: {fileID: 0}
41 | m_GameObject: {fileID: 2663777309796444311}
42 | m_Enabled: 1
43 | serializedVersion: 2
44 | m_ClearFlags: 1
45 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
46 | m_projectionMatrixMode: 1
47 | m_GateFitMode: 2
48 | m_FOVAxisMode: 0
49 | m_SensorSize: {x: 36, y: 24}
50 | m_LensShift: {x: 0, y: 0}
51 | m_FocalLength: 50
52 | m_NormalizedViewPortRect:
53 | serializedVersion: 2
54 | x: 0
55 | y: 0
56 | width: 1
57 | height: 1
58 | near clip plane: 0.3
59 | far clip plane: 1000
60 | field of view: 60
61 | orthographic: 0
62 | orthographic size: 5
63 | m_Depth: 0
64 | m_CullingMask:
65 | serializedVersion: 2
66 | m_Bits: 4294967295
67 | m_RenderingPath: -1
68 | m_TargetTexture: {fileID: 0}
69 | m_TargetDisplay: 0
70 | m_TargetEye: 3
71 | m_HDR: 1
72 | m_AllowMSAA: 1
73 | m_AllowDynamicResolution: 0
74 | m_ForceIntoRT: 0
75 | m_OcclusionCulling: 1
76 | m_StereoConvergence: 10
77 | m_StereoSeparation: 0.022
78 | --- !u!81 &2663777309796444309
79 | AudioListener:
80 | m_ObjectHideFlags: 0
81 | m_CorrespondingSourceObject: {fileID: 0}
82 | m_PrefabInstance: {fileID: 0}
83 | m_PrefabAsset: {fileID: 0}
84 | m_GameObject: {fileID: 2663777309796444311}
85 | m_Enabled: 1
86 | --- !u!1 &2663777310075298554
87 | GameObject:
88 | m_ObjectHideFlags: 0
89 | m_CorrespondingSourceObject: {fileID: 0}
90 | m_PrefabInstance: {fileID: 0}
91 | m_PrefabAsset: {fileID: 0}
92 | serializedVersion: 6
93 | m_Component:
94 | - component: {fileID: 2663777310075298500}
95 | - component: {fileID: 2663777310075298503}
96 | - component: {fileID: 2663777310075298502}
97 | - component: {fileID: 2663777310075298553}
98 | - component: {fileID: 2663777310075298552}
99 | - component: {fileID: 2663777310075298555}
100 | m_Layer: 0
101 | m_Name: FPS Controller
102 | m_TagString: Untagged
103 | m_Icon: {fileID: 0}
104 | m_NavMeshLayer: 0
105 | m_StaticEditorFlags: 0
106 | m_IsActive: 1
107 | --- !u!4 &2663777310075298500
108 | Transform:
109 | m_ObjectHideFlags: 0
110 | m_CorrespondingSourceObject: {fileID: 0}
111 | m_PrefabInstance: {fileID: 0}
112 | m_PrefabAsset: {fileID: 0}
113 | m_GameObject: {fileID: 2663777310075298554}
114 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
115 | m_LocalPosition: {x: 10.206562, y: -0.32, z: -1.8597907}
116 | m_LocalScale: {x: 1, y: 1, z: 1}
117 | m_Children:
118 | - {fileID: 2663777309796444308}
119 | m_Father: {fileID: 0}
120 | m_RootOrder: 0
121 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
122 | --- !u!33 &2663777310075298503
123 | MeshFilter:
124 | m_ObjectHideFlags: 0
125 | m_CorrespondingSourceObject: {fileID: 0}
126 | m_PrefabInstance: {fileID: 0}
127 | m_PrefabAsset: {fileID: 0}
128 | m_GameObject: {fileID: 2663777310075298554}
129 | m_Mesh: {fileID: 10208, guid: 0000000000000000e000000000000000, type: 0}
130 | --- !u!23 &2663777310075298502
131 | MeshRenderer:
132 | m_ObjectHideFlags: 0
133 | m_CorrespondingSourceObject: {fileID: 0}
134 | m_PrefabInstance: {fileID: 0}
135 | m_PrefabAsset: {fileID: 0}
136 | m_GameObject: {fileID: 2663777310075298554}
137 | m_Enabled: 1
138 | m_CastShadows: 1
139 | m_ReceiveShadows: 1
140 | m_DynamicOccludee: 1
141 | m_MotionVectors: 1
142 | m_LightProbeUsage: 1
143 | m_ReflectionProbeUsage: 1
144 | m_RayTracingMode: 2
145 | m_RayTraceProcedural: 0
146 | m_RenderingLayerMask: 1
147 | m_RendererPriority: 0
148 | m_Materials:
149 | - {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
150 | m_StaticBatchInfo:
151 | firstSubMesh: 0
152 | subMeshCount: 0
153 | m_StaticBatchRoot: {fileID: 0}
154 | m_ProbeAnchor: {fileID: 0}
155 | m_LightProbeVolumeOverride: {fileID: 0}
156 | m_ScaleInLightmap: 1
157 | m_ReceiveGI: 1
158 | m_PreserveUVs: 0
159 | m_IgnoreNormalsForChartDetection: 0
160 | m_ImportantGI: 0
161 | m_StitchLightmapSeams: 1
162 | m_SelectedEditorRenderState: 3
163 | m_MinimumChartSize: 4
164 | m_AutoUVMaxDistance: 0.5
165 | m_AutoUVMaxAngle: 89
166 | m_LightmapParameters: {fileID: 0}
167 | m_SortingLayerID: 0
168 | m_SortingLayer: 0
169 | m_SortingOrder: 0
170 | m_AdditionalVertexStreams: {fileID: 0}
171 | --- !u!136 &2663777310075298553
172 | CapsuleCollider:
173 | m_ObjectHideFlags: 0
174 | m_CorrespondingSourceObject: {fileID: 0}
175 | m_PrefabInstance: {fileID: 0}
176 | m_PrefabAsset: {fileID: 0}
177 | m_GameObject: {fileID: 2663777310075298554}
178 | m_Material: {fileID: 0}
179 | m_IsTrigger: 0
180 | m_Enabled: 1
181 | m_Radius: 0.5
182 | m_Height: 2
183 | m_Direction: 1
184 | m_Center: {x: 0, y: 0, z: 0}
185 | --- !u!54 &2663777310075298552
186 | Rigidbody:
187 | m_ObjectHideFlags: 0
188 | m_CorrespondingSourceObject: {fileID: 0}
189 | m_PrefabInstance: {fileID: 0}
190 | m_PrefabAsset: {fileID: 0}
191 | m_GameObject: {fileID: 2663777310075298554}
192 | serializedVersion: 2
193 | m_Mass: 1
194 | m_Drag: 0
195 | m_AngularDrag: 0.05
196 | m_UseGravity: 1
197 | m_IsKinematic: 0
198 | m_Interpolate: 0
199 | m_Constraints: 112
200 | m_CollisionDetection: 0
201 | --- !u!114 &2663777310075298555
202 | MonoBehaviour:
203 | m_ObjectHideFlags: 0
204 | m_CorrespondingSourceObject: {fileID: 0}
205 | m_PrefabInstance: {fileID: 0}
206 | m_PrefabAsset: {fileID: 0}
207 | m_GameObject: {fileID: 2663777310075298554}
208 | m_Enabled: 1
209 | m_EditorHideFlags: 0
210 | m_Script: {fileID: 11500000, guid: ca892250c8b2f524f8c59d779ae1238b, type: 3}
211 | m_Name:
212 | m_EditorClassIdentifier:
213 | speed: 3
214 | jumpForce: 5
215 | mouseSensitivity: 3
216 | childCamera: {fileID: 2663777309796444306}
217 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Prefabs/FPS Controller.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1134e4362002fa84094d806ed1b9daf5
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Prefabs/LogToScreen.prefab:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1 &4983183233340937028
4 | GameObject:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | serializedVersion: 6
10 | m_Component:
11 | - component: {fileID: 4983183233340937050}
12 | - component: {fileID: 4983183233340937029}
13 | m_Layer: 0
14 | m_Name: LogToScreen
15 | m_TagString: Untagged
16 | m_Icon: {fileID: 0}
17 | m_NavMeshLayer: 0
18 | m_StaticEditorFlags: 0
19 | m_IsActive: 1
20 | --- !u!4 &4983183233340937050
21 | Transform:
22 | m_ObjectHideFlags: 0
23 | m_CorrespondingSourceObject: {fileID: 0}
24 | m_PrefabInstance: {fileID: 0}
25 | m_PrefabAsset: {fileID: 0}
26 | m_GameObject: {fileID: 4983183233340937028}
27 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
28 | m_LocalPosition: {x: 0, y: 0, z: 0}
29 | m_LocalScale: {x: 1, y: 1, z: 1}
30 | m_Children: []
31 | m_Father: {fileID: 0}
32 | m_RootOrder: 0
33 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
34 | --- !u!114 &4983183233340937029
35 | MonoBehaviour:
36 | m_ObjectHideFlags: 0
37 | m_CorrespondingSourceObject: {fileID: 0}
38 | m_PrefabInstance: {fileID: 0}
39 | m_PrefabAsset: {fileID: 0}
40 | m_GameObject: {fileID: 4983183233340937028}
41 | m_Enabled: 1
42 | m_EditorHideFlags: 0
43 | m_Script: {fileID: 11500000, guid: 2aba1d6c9e12c4541ab6dbe2372e7a2b, type: 3}
44 | m_Name:
45 | m_EditorClassIdentifier:
46 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Prefabs/LogToScreen.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ea11514bf79b75c42b1ef9a14513cfed
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 152764ba176a2e441bb3e66d428c6484
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19519ee5193bc9e44ba70b105967c19e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6c5442efb86b7ce45b6628bb549c9e70
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/BetterPP.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &-517665122381357115
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 3
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: 48a79b01ea5641d4aa6daa2e23605641, type: 3}
13 | m_Name: Bloom
14 | m_EditorClassIdentifier:
15 | active: 1
16 | enabled:
17 | overrideState: 1
18 | value: 1
19 | intensity:
20 | overrideState: 1
21 | value: 24.85
22 | threshold:
23 | overrideState: 0
24 | value: 1
25 | softKnee:
26 | overrideState: 0
27 | value: 0.5
28 | clamp:
29 | overrideState: 0
30 | value: 65472
31 | diffusion:
32 | overrideState: 0
33 | value: 7
34 | anamorphicRatio:
35 | overrideState: 0
36 | value: 0
37 | color:
38 | overrideState: 0
39 | value: {r: 1, g: 1, b: 1, a: 1}
40 | fastMode:
41 | overrideState: 0
42 | value: 0
43 | dirtTexture:
44 | overrideState: 0
45 | value: {fileID: 0}
46 | defaultState: 1
47 | dirtIntensity:
48 | overrideState: 0
49 | value: 0
50 | --- !u!114 &11400000
51 | MonoBehaviour:
52 | m_ObjectHideFlags: 0
53 | m_CorrespondingSourceObject: {fileID: 0}
54 | m_PrefabInstance: {fileID: 0}
55 | m_PrefabAsset: {fileID: 0}
56 | m_GameObject: {fileID: 0}
57 | m_Enabled: 1
58 | m_EditorHideFlags: 0
59 | m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3}
60 | m_Name: BetterPP
61 | m_EditorClassIdentifier:
62 | settings:
63 | - {fileID: -517665122381357115}
64 | - {fileID: 7485982530118478867}
65 | - {fileID: 2220822030249804128}
66 | --- !u!114 &2220822030249804128
67 | MonoBehaviour:
68 | m_ObjectHideFlags: 3
69 | m_CorrespondingSourceObject: {fileID: 0}
70 | m_PrefabInstance: {fileID: 0}
71 | m_PrefabAsset: {fileID: 0}
72 | m_GameObject: {fileID: 0}
73 | m_Enabled: 1
74 | m_EditorHideFlags: 0
75 | m_Script: {fileID: 11500000, guid: b94fcd11afffcb142908bfcb1e261fba, type: 3}
76 | m_Name: MotionBlur
77 | m_EditorClassIdentifier:
78 | active: 1
79 | enabled:
80 | overrideState: 1
81 | value: 1
82 | shutterAngle:
83 | overrideState: 0
84 | value: 270
85 | sampleCount:
86 | overrideState: 0
87 | value: 10
88 | --- !u!114 &7485982530118478867
89 | MonoBehaviour:
90 | m_ObjectHideFlags: 3
91 | m_CorrespondingSourceObject: {fileID: 0}
92 | m_PrefabInstance: {fileID: 0}
93 | m_PrefabAsset: {fileID: 0}
94 | m_GameObject: {fileID: 0}
95 | m_Enabled: 1
96 | m_EditorHideFlags: 0
97 | m_Script: {fileID: 11500000, guid: 40b924e2dad56384a8df2a1e111bb675, type: 3}
98 | m_Name: Vignette
99 | m_EditorClassIdentifier:
100 | active: 1
101 | enabled:
102 | overrideState: 1
103 | value: 1
104 | mode:
105 | overrideState: 1
106 | value: 0
107 | color:
108 | overrideState: 1
109 | value: {r: 0, g: 0, b: 0, a: 1}
110 | center:
111 | overrideState: 0
112 | value: {x: 0.5, y: 0.5}
113 | intensity:
114 | overrideState: 1
115 | value: 0.394
116 | smoothness:
117 | overrideState: 0
118 | value: 0.2
119 | roundness:
120 | overrideState: 0
121 | value: 1
122 | rounded:
123 | overrideState: 0
124 | value: 0
125 | mask:
126 | overrideState: 0
127 | value: {fileID: 0}
128 | defaultState: 1
129 | opacity:
130 | overrideState: 0
131 | value: 1
132 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/BetterPP.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8dd881d845575e54aacf4f1d352227f1
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 11400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ac35d9df4ad4ffe4da84d6a6f87b1d7b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/BetterSkybox.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: BetterSkybox
11 | m_Shader: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords:
13 | - _SUNDISK_HIGH_QUALITY
14 | m_InvalidKeywords: []
15 | m_LightmapFlags: 4
16 | m_EnableInstancingVariants: 0
17 | m_DoubleSidedGI: 0
18 | m_CustomRenderQueue: -1
19 | stringTagMap: {}
20 | disabledShaderPasses: []
21 | m_SavedProperties:
22 | serializedVersion: 3
23 | m_TexEnvs:
24 | - _BackTex:
25 | m_Texture: {fileID: 0}
26 | m_Scale: {x: 1, y: 1}
27 | m_Offset: {x: 0, y: 0}
28 | - _BumpMap:
29 | m_Texture: {fileID: 0}
30 | m_Scale: {x: 1, y: 1}
31 | m_Offset: {x: 0, y: 0}
32 | - _DetailAlbedoMap:
33 | m_Texture: {fileID: 0}
34 | m_Scale: {x: 1, y: 1}
35 | m_Offset: {x: 0, y: 0}
36 | - _DetailMask:
37 | m_Texture: {fileID: 0}
38 | m_Scale: {x: 1, y: 1}
39 | m_Offset: {x: 0, y: 0}
40 | - _DetailNormalMap:
41 | m_Texture: {fileID: 0}
42 | m_Scale: {x: 1, y: 1}
43 | m_Offset: {x: 0, y: 0}
44 | - _DownTex:
45 | m_Texture: {fileID: 0}
46 | m_Scale: {x: 1, y: 1}
47 | m_Offset: {x: 0, y: 0}
48 | - _EmissionMap:
49 | m_Texture: {fileID: 0}
50 | m_Scale: {x: 1, y: 1}
51 | m_Offset: {x: 0, y: 0}
52 | - _FrontTex:
53 | m_Texture: {fileID: 0}
54 | m_Scale: {x: 1, y: 1}
55 | m_Offset: {x: 0, y: 0}
56 | - _LeftTex:
57 | m_Texture: {fileID: 0}
58 | m_Scale: {x: 1, y: 1}
59 | m_Offset: {x: 0, y: 0}
60 | - _MainTex:
61 | m_Texture: {fileID: 0}
62 | m_Scale: {x: 1, y: 1}
63 | m_Offset: {x: 0, y: 0}
64 | - _MetallicGlossMap:
65 | m_Texture: {fileID: 0}
66 | m_Scale: {x: 1, y: 1}
67 | m_Offset: {x: 0, y: 0}
68 | - _OcclusionMap:
69 | m_Texture: {fileID: 0}
70 | m_Scale: {x: 1, y: 1}
71 | m_Offset: {x: 0, y: 0}
72 | - _ParallaxMap:
73 | m_Texture: {fileID: 0}
74 | m_Scale: {x: 1, y: 1}
75 | m_Offset: {x: 0, y: 0}
76 | - _RightTex:
77 | m_Texture: {fileID: 0}
78 | m_Scale: {x: 1, y: 1}
79 | m_Offset: {x: 0, y: 0}
80 | - _UpTex:
81 | m_Texture: {fileID: 0}
82 | m_Scale: {x: 1, y: 1}
83 | m_Offset: {x: 0, y: 0}
84 | m_Ints: []
85 | m_Floats:
86 | - _AtmosphereThickness: 0.9
87 | - _BumpScale: 1
88 | - _Cutoff: 0.5
89 | - _DetailNormalMapScale: 1
90 | - _DstBlend: 0
91 | - _Exposure: 0.7
92 | - _GlossMapScale: 1
93 | - _Glossiness: 0.5
94 | - _GlossyReflections: 1
95 | - _Metallic: 0
96 | - _Mode: 0
97 | - _OcclusionStrength: 1
98 | - _Parallax: 0.02
99 | - _SmoothnessTextureChannel: 0
100 | - _SpecularHighlights: 1
101 | - _SrcBlend: 1
102 | - _SunDisk: 2
103 | - _SunSize: 0.064
104 | - _SunSizeConvergence: 1
105 | - _UVSec: 0
106 | - _ZWrite: 1
107 | m_Colors:
108 | - _Color: {r: 1, g: 1, b: 1, a: 1}
109 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
110 | - _GroundColor: {r: 0.1981132, g: 0.1981132, b: 0.1981132, a: 1}
111 | - _SkyTint: {r: 0.7264151, g: 0.7264151, b: 0.7264151, a: 1}
112 | m_BuildTextureStacks: []
113 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/BetterSkybox.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9040e7c63d316f40a11b301a49b2d68
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/DefaultGround.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: DefaultGround
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords: []
13 | m_InvalidKeywords: []
14 | m_LightmapFlags: 4
15 | m_EnableInstancingVariants: 0
16 | m_DoubleSidedGI: 0
17 | m_CustomRenderQueue: -1
18 | stringTagMap: {}
19 | disabledShaderPasses: []
20 | m_SavedProperties:
21 | serializedVersion: 3
22 | m_TexEnvs:
23 | - _BumpMap:
24 | m_Texture: {fileID: 0}
25 | m_Scale: {x: 1, y: 1}
26 | m_Offset: {x: 0, y: 0}
27 | - _DetailAlbedoMap:
28 | m_Texture: {fileID: 0}
29 | m_Scale: {x: 1, y: 1}
30 | m_Offset: {x: 0, y: 0}
31 | - _DetailMask:
32 | m_Texture: {fileID: 0}
33 | m_Scale: {x: 1, y: 1}
34 | m_Offset: {x: 0, y: 0}
35 | - _DetailNormalMap:
36 | m_Texture: {fileID: 0}
37 | m_Scale: {x: 1, y: 1}
38 | m_Offset: {x: 0, y: 0}
39 | - _EmissionMap:
40 | m_Texture: {fileID: 0}
41 | m_Scale: {x: 1, y: 1}
42 | m_Offset: {x: 0, y: 0}
43 | - _MainTex:
44 | m_Texture: {fileID: 0}
45 | m_Scale: {x: 1, y: 1}
46 | m_Offset: {x: 0, y: 0}
47 | - _MetallicGlossMap:
48 | m_Texture: {fileID: 0}
49 | m_Scale: {x: 1, y: 1}
50 | m_Offset: {x: 0, y: 0}
51 | - _OcclusionMap:
52 | m_Texture: {fileID: 0}
53 | m_Scale: {x: 1, y: 1}
54 | m_Offset: {x: 0, y: 0}
55 | - _ParallaxMap:
56 | m_Texture: {fileID: 0}
57 | m_Scale: {x: 1, y: 1}
58 | m_Offset: {x: 0, y: 0}
59 | m_Ints: []
60 | m_Floats:
61 | - _BumpScale: 1
62 | - _Cutoff: 0.5
63 | - _DetailNormalMapScale: 1
64 | - _DstBlend: 0
65 | - _GlossMapScale: 1
66 | - _Glossiness: 1
67 | - _GlossyReflections: 1
68 | - _Metallic: 0.728
69 | - _Mode: 0
70 | - _OcclusionStrength: 1
71 | - _Parallax: 0.02
72 | - _SmoothnessTextureChannel: 0
73 | - _SpecularHighlights: 1
74 | - _SrcBlend: 1
75 | - _UVSec: 0
76 | - _ZWrite: 1
77 | m_Colors:
78 | - _Color: {r: 0.1981132, g: 0.1981132, b: 0.1981132, a: 1}
79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
80 | m_BuildTextureStacks: []
81 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/DefaultGround.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5aa0f46a34510242abb3d587544cae3
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/DefaultObject.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: DefaultObject
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords: []
13 | m_InvalidKeywords: []
14 | m_LightmapFlags: 4
15 | m_EnableInstancingVariants: 0
16 | m_DoubleSidedGI: 0
17 | m_CustomRenderQueue: -1
18 | stringTagMap: {}
19 | disabledShaderPasses: []
20 | m_SavedProperties:
21 | serializedVersion: 3
22 | m_TexEnvs:
23 | - _BumpMap:
24 | m_Texture: {fileID: 0}
25 | m_Scale: {x: 1, y: 1}
26 | m_Offset: {x: 0, y: 0}
27 | - _DetailAlbedoMap:
28 | m_Texture: {fileID: 0}
29 | m_Scale: {x: 1, y: 1}
30 | m_Offset: {x: 0, y: 0}
31 | - _DetailMask:
32 | m_Texture: {fileID: 0}
33 | m_Scale: {x: 1, y: 1}
34 | m_Offset: {x: 0, y: 0}
35 | - _DetailNormalMap:
36 | m_Texture: {fileID: 0}
37 | m_Scale: {x: 1, y: 1}
38 | m_Offset: {x: 0, y: 0}
39 | - _EmissionMap:
40 | m_Texture: {fileID: 0}
41 | m_Scale: {x: 1, y: 1}
42 | m_Offset: {x: 0, y: 0}
43 | - _MainTex:
44 | m_Texture: {fileID: 0}
45 | m_Scale: {x: 1, y: 1}
46 | m_Offset: {x: 0, y: 0}
47 | - _MetallicGlossMap:
48 | m_Texture: {fileID: 0}
49 | m_Scale: {x: 1, y: 1}
50 | m_Offset: {x: 0, y: 0}
51 | - _OcclusionMap:
52 | m_Texture: {fileID: 0}
53 | m_Scale: {x: 1, y: 1}
54 | m_Offset: {x: 0, y: 0}
55 | - _ParallaxMap:
56 | m_Texture: {fileID: 0}
57 | m_Scale: {x: 1, y: 1}
58 | m_Offset: {x: 0, y: 0}
59 | m_Ints: []
60 | m_Floats:
61 | - _BumpScale: 1
62 | - _Cutoff: 0.5
63 | - _DetailNormalMapScale: 1
64 | - _DstBlend: 0
65 | - _GlossMapScale: 1
66 | - _Glossiness: 0
67 | - _GlossyReflections: 1
68 | - _Metallic: 0.675
69 | - _Mode: 0
70 | - _OcclusionStrength: 1
71 | - _Parallax: 0.02
72 | - _SmoothnessTextureChannel: 0
73 | - _SpecularHighlights: 1
74 | - _SrcBlend: 1
75 | - _UVSec: 0
76 | - _ZWrite: 1
77 | m_Colors:
78 | - _Color: {r: 1, g: 0.83581686, b: 0, a: 1}
79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
80 | m_BuildTextureStacks: []
81 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/DefaultObject.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 48e5d06fdf3c4cf40abdded96f84246b
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/NonBlindingWhite.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: NonBlindingWhite
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.745283, g: 0.52015734, b: 0.03163936, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 | m_BuildTextureStacks: []
79 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/NonBlindingWhite.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9f8b2577070bbbf4c9a2a16e33d3d40d
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/black.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: black
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.944
65 | - _GlossyReflections: 1
66 | - _Metallic: 0.408
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.2830189, g: 0.2830189, b: 0.2830189, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 | m_BuildTextureStacks: []
79 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/BetterScene/Materials/black.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eb30b1aade8c3074abf39db503a99316
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/testScene.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 9
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_IndirectSpecularColor: {r: 0.1801959, g: 0.22071801, b: 0.2785804, a: 1}
42 | m_UseRadianceAmbientProbe: 0
43 | --- !u!157 &3
44 | LightmapSettings:
45 | m_ObjectHideFlags: 0
46 | serializedVersion: 12
47 | m_GIWorkflowMode: 1
48 | m_GISettings:
49 | serializedVersion: 2
50 | m_BounceScale: 1
51 | m_IndirectOutputScale: 1
52 | m_AlbedoBoost: 1
53 | m_EnvironmentLightingMode: 0
54 | m_EnableBakedLightmaps: 1
55 | m_EnableRealtimeLightmaps: 0
56 | m_LightmapEditorSettings:
57 | serializedVersion: 12
58 | m_Resolution: 2
59 | m_BakeResolution: 40
60 | m_AtlasSize: 1024
61 | m_AO: 0
62 | m_AOMaxDistance: 1
63 | m_CompAOExponent: 1
64 | m_CompAOExponentDirect: 0
65 | m_ExtractAmbientOcclusion: 0
66 | m_Padding: 2
67 | m_LightmapParameters: {fileID: 0}
68 | m_LightmapsBakeMode: 1
69 | m_TextureCompression: 1
70 | m_FinalGather: 0
71 | m_FinalGatherFiltering: 1
72 | m_FinalGatherRayCount: 256
73 | m_ReflectionCompression: 2
74 | m_MixedBakeMode: 2
75 | m_BakeBackend: 1
76 | m_PVRSampling: 1
77 | m_PVRDirectSampleCount: 32
78 | m_PVRSampleCount: 512
79 | m_PVRBounces: 2
80 | m_PVREnvironmentSampleCount: 256
81 | m_PVREnvironmentReferencePointCount: 2048
82 | m_PVRFilteringMode: 1
83 | m_PVRDenoiserTypeDirect: 1
84 | m_PVRDenoiserTypeIndirect: 1
85 | m_PVRDenoiserTypeAO: 1
86 | m_PVRFilterTypeDirect: 0
87 | m_PVRFilterTypeIndirect: 0
88 | m_PVRFilterTypeAO: 0
89 | m_PVREnvironmentMIS: 1
90 | m_PVRCulling: 1
91 | m_PVRFilteringGaussRadiusDirect: 1
92 | m_PVRFilteringGaussRadiusIndirect: 5
93 | m_PVRFilteringGaussRadiusAO: 2
94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
96 | m_PVRFilteringAtrousPositionSigmaAO: 1
97 | m_ExportTrainingData: 0
98 | m_TrainingDataDestination: TrainingData
99 | m_LightProbeSampleCountMultiplier: 4
100 | m_LightingDataAsset: {fileID: 0}
101 | m_LightingSettings: {fileID: 0}
102 | --- !u!196 &4
103 | NavMeshSettings:
104 | serializedVersion: 2
105 | m_ObjectHideFlags: 0
106 | m_BuildSettings:
107 | serializedVersion: 2
108 | agentTypeID: 0
109 | agentRadius: 0.5
110 | agentHeight: 2
111 | agentSlope: 45
112 | agentClimb: 0.4
113 | ledgeDropHeight: 0
114 | maxJumpAcrossDistance: 0
115 | minRegionArea: 2
116 | manualCellSize: 0
117 | cellSize: 0.16666667
118 | manualTileSize: 0
119 | tileSize: 256
120 | accuratePlacement: 0
121 | maxJobWorkers: 0
122 | preserveTilesOutsideBounds: 0
123 | debug:
124 | m_Flags: 0
125 | m_NavMeshData: {fileID: 0}
126 | --- !u!1 &2056651134
127 | GameObject:
128 | m_ObjectHideFlags: 0
129 | m_CorrespondingSourceObject: {fileID: 0}
130 | m_PrefabInstance: {fileID: 0}
131 | m_PrefabAsset: {fileID: 0}
132 | serializedVersion: 6
133 | m_Component:
134 | - component: {fileID: 2056651136}
135 | - component: {fileID: 2056651135}
136 | m_Layer: 0
137 | m_Name: Directional Light
138 | m_TagString: Untagged
139 | m_Icon: {fileID: 0}
140 | m_NavMeshLayer: 0
141 | m_StaticEditorFlags: 0
142 | m_IsActive: 1
143 | --- !u!108 &2056651135
144 | Light:
145 | m_ObjectHideFlags: 0
146 | m_CorrespondingSourceObject: {fileID: 0}
147 | m_PrefabInstance: {fileID: 0}
148 | m_PrefabAsset: {fileID: 0}
149 | m_GameObject: {fileID: 2056651134}
150 | m_Enabled: 1
151 | serializedVersion: 10
152 | m_Type: 1
153 | m_Shape: 0
154 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
155 | m_Intensity: 1
156 | m_Range: 10
157 | m_SpotAngle: 30
158 | m_InnerSpotAngle: 21.80208
159 | m_CookieSize: 10
160 | m_Shadows:
161 | m_Type: 2
162 | m_Resolution: -1
163 | m_CustomResolution: -1
164 | m_Strength: 1
165 | m_Bias: 0.05
166 | m_NormalBias: 0.4
167 | m_NearPlane: 0.2
168 | m_CullingMatrixOverride:
169 | e00: 1
170 | e01: 0
171 | e02: 0
172 | e03: 0
173 | e10: 0
174 | e11: 1
175 | e12: 0
176 | e13: 0
177 | e20: 0
178 | e21: 0
179 | e22: 1
180 | e23: 0
181 | e30: 0
182 | e31: 0
183 | e32: 0
184 | e33: 1
185 | m_UseCullingMatrixOverride: 0
186 | m_Cookie: {fileID: 0}
187 | m_DrawHalo: 0
188 | m_Flare: {fileID: 0}
189 | m_RenderMode: 0
190 | m_CullingMask:
191 | serializedVersion: 2
192 | m_Bits: 4294967295
193 | m_RenderingLayerMask: 1
194 | m_Lightmapping: 4
195 | m_LightShadowCasterMode: 0
196 | m_AreaSize: {x: 1, y: 1}
197 | m_BounceIntensity: 1
198 | m_ColorTemperature: 6570
199 | m_UseColorTemperature: 0
200 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
201 | m_UseBoundingSphereOverride: 0
202 | m_UseViewFrustumForShadowCasterCull: 1
203 | m_ShadowRadius: 0
204 | m_ShadowAngle: 0
205 | --- !u!4 &2056651136
206 | Transform:
207 | m_ObjectHideFlags: 0
208 | m_CorrespondingSourceObject: {fileID: 0}
209 | m_PrefabInstance: {fileID: 0}
210 | m_PrefabAsset: {fileID: 0}
211 | m_GameObject: {fileID: 2056651134}
212 | m_LocalRotation: {x: 0.111914486, y: -0.18821697, z: 0.1776562, w: 0.95942056}
213 | m_LocalPosition: {x: 0, y: 3, z: 0}
214 | m_LocalScale: {x: 1, y: 1, z: 1}
215 | m_ConstrainProportionsScale: 0
216 | m_Children: []
217 | m_Father: {fileID: 0}
218 | m_RootOrder: 1
219 | m_LocalEulerAnglesHint: {x: 16.357, y: -19.57, z: 18.142}
220 | --- !u!1 &2092450759
221 | GameObject:
222 | m_ObjectHideFlags: 0
223 | m_CorrespondingSourceObject: {fileID: 0}
224 | m_PrefabInstance: {fileID: 0}
225 | m_PrefabAsset: {fileID: 0}
226 | serializedVersion: 6
227 | m_Component:
228 | - component: {fileID: 2092450762}
229 | - component: {fileID: 2092450761}
230 | - component: {fileID: 2092450760}
231 | m_Layer: 0
232 | m_Name: Main Camera
233 | m_TagString: MainCamera
234 | m_Icon: {fileID: 0}
235 | m_NavMeshLayer: 0
236 | m_StaticEditorFlags: 0
237 | m_IsActive: 1
238 | --- !u!81 &2092450760
239 | AudioListener:
240 | m_ObjectHideFlags: 0
241 | m_CorrespondingSourceObject: {fileID: 0}
242 | m_PrefabInstance: {fileID: 0}
243 | m_PrefabAsset: {fileID: 0}
244 | m_GameObject: {fileID: 2092450759}
245 | m_Enabled: 1
246 | --- !u!20 &2092450761
247 | Camera:
248 | m_ObjectHideFlags: 0
249 | m_CorrespondingSourceObject: {fileID: 0}
250 | m_PrefabInstance: {fileID: 0}
251 | m_PrefabAsset: {fileID: 0}
252 | m_GameObject: {fileID: 2092450759}
253 | m_Enabled: 1
254 | serializedVersion: 2
255 | m_ClearFlags: 1
256 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
257 | m_projectionMatrixMode: 1
258 | m_GateFitMode: 2
259 | m_FOVAxisMode: 0
260 | m_SensorSize: {x: 36, y: 24}
261 | m_LensShift: {x: 0, y: 0}
262 | m_FocalLength: 50
263 | m_NormalizedViewPortRect:
264 | serializedVersion: 2
265 | x: 0
266 | y: 0
267 | width: 1
268 | height: 1
269 | near clip plane: 0.3
270 | far clip plane: 1000
271 | field of view: 60
272 | orthographic: 0
273 | orthographic size: 5
274 | m_Depth: -1
275 | m_CullingMask:
276 | serializedVersion: 2
277 | m_Bits: 4294967295
278 | m_RenderingPath: -1
279 | m_TargetTexture: {fileID: 0}
280 | m_TargetDisplay: 0
281 | m_TargetEye: 3
282 | m_HDR: 1
283 | m_AllowMSAA: 1
284 | m_AllowDynamicResolution: 0
285 | m_ForceIntoRT: 0
286 | m_OcclusionCulling: 1
287 | m_StereoConvergence: 10
288 | m_StereoSeparation: 0.022
289 | --- !u!4 &2092450762
290 | Transform:
291 | m_ObjectHideFlags: 0
292 | m_CorrespondingSourceObject: {fileID: 0}
293 | m_PrefabInstance: {fileID: 0}
294 | m_PrefabAsset: {fileID: 0}
295 | m_GameObject: {fileID: 2092450759}
296 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
297 | m_LocalPosition: {x: 0, y: 1, z: -10}
298 | m_LocalScale: {x: 1, y: 1, z: 1}
299 | m_ConstrainProportionsScale: 0
300 | m_Children: []
301 | m_Father: {fileID: 0}
302 | m_RootOrder: 0
303 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
304 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/Scenes/testScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 219f5b7d3a02ad4478df0162e17f1d3f
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/TestScripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1fa15e28855f6b84693819f40ebb9c7a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/TestScripts/TestScript.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEngine.Search;
5 |
6 | public class TestScript : MonoBehaviour
7 | {
8 | [BetterHeader("Score")]
9 |
10 | [Optional]
11 | public int additionalPoints;
12 |
13 | public float mainPoints;
14 |
15 | [Label("The field below is how subheadings could be used to define different portions.")]
16 |
17 | [BetterHeader("Layers", true,true)]
18 |
19 | [Optional]
20 | public float numberOfLayers = 5;
21 |
22 | [SerializeField, Layer]
23 | int layer;
24 |
25 | [Label("Assignment of the field below is essential.")]
26 |
27 | [NullCheck]
28 | public Transform myField;
29 |
30 | [BetterHeader("Alignment Settings")]
31 |
32 | [NullCheck]
33 | public Transform alignObject;
34 |
35 | [Optional]
36 | public Color test;
37 |
38 | public int index;
39 |
40 | [InspectorButton("TestFunc2", "Custom Button Call!")]
41 | public char c;
42 |
43 | [CallInEditor]
44 | public void TestFunc1()
45 | {
46 | Debug.Log("Called Test1!");
47 | }
48 |
49 | [CallInEditor]
50 | public void TestFunc2()
51 | {
52 | Debug.Log("Called Test2!");
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/TestScripts/TestScript.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 90a36aa442210f4459fa5d08e5b518cd
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/TestScripts/testui.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | [ExecuteAlways]
6 | public class testui : MonoBehaviour
7 | {
8 | public string text;
9 |
10 | [Range(0,160)]
11 | public int textLength;
12 |
13 | //[Range(0,400)]
14 | public float add = 10;
15 |
16 | const string glyphs = "abcdefghijklmnopqrstsdfasdfsadjfhsadfjkbhsagkjldsbgjdsfklgdsfjbgldsfgdsfgdsfgdfsgdsfgsfsdsdgklgdsfjbgldsfgdsfgdsfgdfsgdsfgdfsgsdfgsdfgsdfguvwxyz0123456789sdaknfksadnflsdasdfgsdfskdff";
17 |
18 | // Start is called before the first frame update
19 | void Start()
20 | {
21 |
22 | }
23 |
24 | // Update is called once per frame
25 | void Update()
26 | {
27 | text = glyphs.Substring(0, textLength);
28 |
29 | if(textLength>=100)
30 | add = HelperFunctions.ScaleRange((float)text.Length, 100, 160, 0.9f, 0.85f);
31 | else if (textLength >= 25)
32 | add = HelperFunctions.ScaleRange((float)text.Length, 25, 100, 0.95f, 0.9f);
33 | else if(textLength<9)
34 | add = 1.25f;
35 | else
36 | add = 1;
37 |
38 |
39 | }
40 |
41 | private void OnGUI()
42 | {
43 | Rect buttonRect = new Rect(30, 200, add * 7 * text.Length, 30);
44 | GUI.Box(buttonRect, text);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/TestScripts/testui.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 27b6bf7e0fc13b84c98d89db8d59994d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/VR.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5de68ec91b4d35a489ef88742cb8f43e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/VR/HeadLevel.cs:
--------------------------------------------------------------------------------
1 | //Derived from Microsoft's MRTK follow script.
2 |
3 | using UnityEngine;
4 |
5 | public enum FollowType
6 | {
7 | FollowHeadBasic, FollowAndFace, FaceHeadBasic
8 | }
9 |
10 | public enum FollowType_FaceCustomization
11 | {
12 | FullFace, OnlyX, OnlyY
13 | }
14 |
15 | public class HeadLevel : MonoBehaviour
16 | {
17 |
18 | [SerializeField]
19 | FollowType followType;
20 |
21 | float timeElapsed;
22 |
23 | float valueToLerp;
24 |
25 | [Tooltip("Center Eye Anchor (represents head) to follow.")]
26 | public Transform centerEyeToFollow;
27 |
28 | [Header("Attributes")]
29 |
30 | [Tooltip("Lerp Duration of the follow (Smoothing).")]
31 | public float lerpDuration = 3;
32 |
33 | [Tooltip("Offset from the center eye.")]
34 | public float offset = -0.5f;
35 |
36 | [Header("Follow Settings")]
37 | [SerializeField]
38 | bool ignoreNearFarDistanceMovement;
39 |
40 | [SerializeField]
41 | [Tooltip("Min distance from eye to position element around, i.e. the sphere radius")]
42 | private float minDistance = 1f;
43 |
44 | [SerializeField]
45 | [Tooltip("Max distance from eye to element")]
46 | private float maxDistance = 2f;
47 |
48 | [SerializeField]
49 | [Tooltip("Move head as is required.")]
50 | bool doHeadYInstantMovement = true;
51 |
52 | [Header("Face Settings")]
53 |
54 | //If follow is set to follow and face
55 | [SerializeField]
56 | FollowType_FaceCustomization faceCustomization;
57 |
58 | [SerializeField]
59 | bool ignoreAngleClamp;
60 |
61 | [SerializeField]
62 | [Tooltip("The element will stay at least this far away from the center of view")]
63 | private float minViewDegrees = 0f;
64 |
65 | [SerializeField]
66 | [Tooltip("The element will stay at least this close to the center of view")]
67 | private float maxViewDegrees = 30f;
68 |
69 | [SerializeField]
70 | [Tooltip("Apply a different clamp to vertical FOV than horizontal. Vertical = Horizontal * aspectV")]
71 | private float aspectV = 1f;
72 |
73 | private Vector3 targetPosition;
74 | private Quaternion targetRotation;
75 |
76 | // Update is called once per frame
77 | void Update()
78 | {
79 | if (timeElapsed < lerpDuration)
80 | {
81 | valueToLerp = timeElapsed / lerpDuration;
82 | timeElapsed += Time.deltaTime;
83 | }
84 | else
85 | {
86 | timeElapsed = 0;
87 | }
88 |
89 | // Lerp for position
90 | Vector3 lerpedPosition = Vector3.Lerp(transform.position, targetPosition, valueToLerp);
91 |
92 | // Lerp for rotation
93 | Quaternion lerpedRotation = Quaternion.Lerp(transform.rotation, targetRotation, valueToLerp);
94 |
95 | transform.SetPositionAndRotation(lerpedPosition, lerpedRotation);
96 |
97 | Debug.Log(valueToLerp);
98 | //transform.SetPositionAndRotation(new Vector3(transform.position.x, centerEyeToFollow.position.y + offset, transform.position.z), transform.rotation);
99 |
100 | SolverUpdate();
101 | }
102 |
103 | public void SolverUpdate()
104 | {
105 | Vector3 goalPosition = transform.position;
106 |
107 | if (ignoreAngleClamp)
108 | {
109 | if (ignoreNearFarDistanceMovement)
110 | {
111 | goalPosition = transform.position;
112 | }
113 | else
114 | {
115 | GetDesiredOrientation_DistanceOnly(ref goalPosition);
116 | }
117 | }
118 | else
119 | {
120 | GetDesiredOrientation(ref goalPosition);
121 | }
122 |
123 | // Element orientation
124 | Vector3 refDirUp = Vector3.up;
125 | Quaternion goalRotation = transform.rotation;
126 |
127 |
128 |
129 | if (doHeadYInstantMovement == true && (followType == FollowType.FollowHeadBasic || followType == FollowType.FollowAndFace))
130 | {
131 | goalPosition = new Vector3(transform.position.x, centerEyeToFollow.position.y, transform.position.z);
132 | }
133 |
134 | if (followType == FollowType.FollowAndFace || followType == FollowType.FaceHeadBasic)
135 | {
136 | GetFaceCustomizationGoalRotation(ref goalRotation, refDirUp);
137 |
138 | if (followType == FollowType.FollowAndFace)
139 | goalPosition = new Vector3(transform.position.x, centerEyeToFollow.position.y, transform.position.z);
140 | }
141 |
142 | targetPosition = goalPosition;
143 | targetRotation = goalRotation;
144 |
145 | //transform.SetPositionAndRotation(goalPosition, goalRotation);
146 | }
147 |
148 | void GetFaceCustomizationGoalRotation(ref Quaternion goalRot, Vector3 refDirUp)
149 | {
150 | if (faceCustomization == FollowType_FaceCustomization.FullFace)
151 | goalRot = Quaternion.LookRotation(centerEyeToFollow.forward, refDirUp);
152 | else if (faceCustomization == FollowType_FaceCustomization.OnlyX)
153 | goalRot = Quaternion.LookRotation(new Vector3(centerEyeToFollow.forward.x, centerEyeToFollow.forward.y, 0), refDirUp);
154 | else if (faceCustomization == FollowType_FaceCustomization.OnlyY)
155 | goalRot = Quaternion.LookRotation(new Vector3(centerEyeToFollow.forward.x, 0, centerEyeToFollow.forward.z), refDirUp);
156 | }
157 |
158 | ///
159 | /// Optimized version of GetDesiredOrientation.
160 | ///
161 | ///
162 | private void GetDesiredOrientation_DistanceOnly(ref Vector3 desiredPos)
163 | {
164 | // TODO: There should be a different solver for distance constraint.
165 | // Determine reference locations and directions
166 | Vector3 refPoint = centerEyeToFollow.forward; // recheck between
167 | Vector3 elementPoint = transform.position;
168 | Vector3 elementDelta = elementPoint - refPoint;
169 | float elementDist = elementDelta.magnitude;
170 | Vector3 elementDir = elementDist > 0 ? elementDelta / elementDist : Vector3.one;
171 |
172 | // Clamp distance too
173 | float clampedDistance = Mathf.Clamp(elementDist, minDistance, maxDistance);
174 |
175 | if (!clampedDistance.Equals(elementDist))
176 | {
177 | desiredPos = refPoint + clampedDistance * elementDir;
178 | }
179 | }
180 |
181 | private void GetDesiredOrientation(ref Vector3 desiredPos)
182 | {
183 | // Determine reference locations and directions
184 | Vector3 direction = centerEyeToFollow.forward; // recheck between this forward or the 'target'
185 | Vector3 upDirection = centerEyeToFollow.up;
186 | Vector3 referencePoint = centerEyeToFollow.position; // recheck between
187 | Vector3 elementPoint = transform.position;
188 | Vector3 elementDelta = elementPoint - referencePoint;
189 | float elementDist = elementDelta.magnitude;
190 | Vector3 elementDir = elementDist > 0 ? elementDelta / elementDist : Vector3.one;
191 |
192 | // Generate basis: First get axis perpendicular to reference direction pointing toward element
193 | Vector3 perpendicularDirection = (elementDir - direction);
194 | perpendicularDirection -= direction * Vector3.Dot(perpendicularDirection, direction);
195 | perpendicularDirection.Normalize();
196 |
197 | // Calculate the clamping angles, accounting for aspect (need the angle relative to view plane)
198 | float heightToViewAngle = Vector3.Angle(perpendicularDirection, upDirection);
199 | float verticalAspectScale = Mathf.Lerp(aspectV, 1f, Mathf.Abs(Mathf.Sin(heightToViewAngle * Mathf.Deg2Rad)));
200 |
201 | // Calculate the current angle
202 | float currentAngle = Vector3.Angle(elementDir, direction);
203 | float currentAngleClamped = Mathf.Clamp(currentAngle, minViewDegrees * verticalAspectScale, maxViewDegrees * verticalAspectScale);
204 |
205 | // Clamp distance too, if desired
206 | float clampedDistance = ignoreNearFarDistanceMovement ? elementDist : Mathf.Clamp(elementDist, minDistance, maxDistance);
207 |
208 | // If the angle was clamped, do some special update stuff
209 | if (currentAngle != currentAngleClamped)
210 | {
211 | float angRad = currentAngleClamped * Mathf.Deg2Rad;
212 |
213 | // Calculate new position
214 | desiredPos = referencePoint + clampedDistance * (direction * Mathf.Cos(angRad) + perpendicularDirection * Mathf.Sin(angRad));
215 | }
216 | else if (!clampedDistance.Equals(elementDist))
217 | {
218 | // Only need to apply distance
219 | desiredPos = referencePoint + clampedDistance * elementDir;
220 | }
221 | }
222 |
223 | public void ResetToZ()
224 | {
225 | Transform childGeneric = transform.GetChild(0);
226 | //childGeneric.parent = null;
227 | //childGeneric.rotation.Set(0, 0, 0, 0);
228 | Vector3 globalPosition = childGeneric.position;
229 | childGeneric.parent = null;
230 | childGeneric.SetPositionAndRotation(childGeneric.position, new Quaternion(0, 0, 0, childGeneric.rotation.w));
231 | //childGeneric.rotation.Set(childGeneric.rotation.x, childGeneric.rotation.y, 0, childGeneric.rotation.w);
232 | }
233 | }
234 |
--------------------------------------------------------------------------------
/Runtime/BetterUnity/VR/HeadLevel.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0a0f6daccbafe1e4a94cc90bc646f3e4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 19519ee5193bc9e44ba70b105967c19e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6c5442efb86b7ce45b6628bb549c9e70
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/BetterPP.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &-517665122381357115
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 3
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: 48a79b01ea5641d4aa6daa2e23605641, type: 3}
13 | m_Name: Bloom
14 | m_EditorClassIdentifier:
15 | active: 1
16 | enabled:
17 | overrideState: 1
18 | value: 1
19 | intensity:
20 | overrideState: 1
21 | value: 24.85
22 | threshold:
23 | overrideState: 0
24 | value: 1
25 | softKnee:
26 | overrideState: 0
27 | value: 0.5
28 | clamp:
29 | overrideState: 0
30 | value: 65472
31 | diffusion:
32 | overrideState: 0
33 | value: 7
34 | anamorphicRatio:
35 | overrideState: 0
36 | value: 0
37 | color:
38 | overrideState: 0
39 | value: {r: 1, g: 1, b: 1, a: 1}
40 | fastMode:
41 | overrideState: 0
42 | value: 0
43 | dirtTexture:
44 | overrideState: 0
45 | value: {fileID: 0}
46 | defaultState: 1
47 | dirtIntensity:
48 | overrideState: 0
49 | value: 0
50 | --- !u!114 &11400000
51 | MonoBehaviour:
52 | m_ObjectHideFlags: 0
53 | m_CorrespondingSourceObject: {fileID: 0}
54 | m_PrefabInstance: {fileID: 0}
55 | m_PrefabAsset: {fileID: 0}
56 | m_GameObject: {fileID: 0}
57 | m_Enabled: 1
58 | m_EditorHideFlags: 0
59 | m_Script: {fileID: 11500000, guid: 8e6292b2c06870d4495f009f912b9600, type: 3}
60 | m_Name: BetterPP
61 | m_EditorClassIdentifier:
62 | settings:
63 | - {fileID: -517665122381357115}
64 | - {fileID: 7485982530118478867}
65 | - {fileID: 2220822030249804128}
66 | --- !u!114 &2220822030249804128
67 | MonoBehaviour:
68 | m_ObjectHideFlags: 3
69 | m_CorrespondingSourceObject: {fileID: 0}
70 | m_PrefabInstance: {fileID: 0}
71 | m_PrefabAsset: {fileID: 0}
72 | m_GameObject: {fileID: 0}
73 | m_Enabled: 1
74 | m_EditorHideFlags: 0
75 | m_Script: {fileID: 11500000, guid: b94fcd11afffcb142908bfcb1e261fba, type: 3}
76 | m_Name: MotionBlur
77 | m_EditorClassIdentifier:
78 | active: 1
79 | enabled:
80 | overrideState: 1
81 | value: 1
82 | shutterAngle:
83 | overrideState: 0
84 | value: 270
85 | sampleCount:
86 | overrideState: 0
87 | value: 10
88 | --- !u!114 &7485982530118478867
89 | MonoBehaviour:
90 | m_ObjectHideFlags: 3
91 | m_CorrespondingSourceObject: {fileID: 0}
92 | m_PrefabInstance: {fileID: 0}
93 | m_PrefabAsset: {fileID: 0}
94 | m_GameObject: {fileID: 0}
95 | m_Enabled: 1
96 | m_EditorHideFlags: 0
97 | m_Script: {fileID: 11500000, guid: 40b924e2dad56384a8df2a1e111bb675, type: 3}
98 | m_Name: Vignette
99 | m_EditorClassIdentifier:
100 | active: 1
101 | enabled:
102 | overrideState: 1
103 | value: 1
104 | mode:
105 | overrideState: 1
106 | value: 0
107 | color:
108 | overrideState: 1
109 | value: {r: 0, g: 0, b: 0, a: 1}
110 | center:
111 | overrideState: 0
112 | value: {x: 0.5, y: 0.5}
113 | intensity:
114 | overrideState: 1
115 | value: 0.394
116 | smoothness:
117 | overrideState: 0
118 | value: 0.2
119 | roundness:
120 | overrideState: 0
121 | value: 1
122 | rounded:
123 | overrideState: 0
124 | value: 0
125 | mask:
126 | overrideState: 0
127 | value: {fileID: 0}
128 | defaultState: 1
129 | opacity:
130 | overrideState: 0
131 | value: 1
132 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/BetterPP.asset.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8dd881d845575e54aacf4f1d352227f1
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 11400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ac35d9df4ad4ffe4da84d6a6f87b1d7b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/BetterSkybox.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: BetterSkybox
11 | m_Shader: {fileID: 106, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords:
13 | - _SUNDISK_HIGH_QUALITY
14 | m_InvalidKeywords: []
15 | m_LightmapFlags: 4
16 | m_EnableInstancingVariants: 0
17 | m_DoubleSidedGI: 0
18 | m_CustomRenderQueue: -1
19 | stringTagMap: {}
20 | disabledShaderPasses: []
21 | m_SavedProperties:
22 | serializedVersion: 3
23 | m_TexEnvs:
24 | - _BackTex:
25 | m_Texture: {fileID: 0}
26 | m_Scale: {x: 1, y: 1}
27 | m_Offset: {x: 0, y: 0}
28 | - _BumpMap:
29 | m_Texture: {fileID: 0}
30 | m_Scale: {x: 1, y: 1}
31 | m_Offset: {x: 0, y: 0}
32 | - _DetailAlbedoMap:
33 | m_Texture: {fileID: 0}
34 | m_Scale: {x: 1, y: 1}
35 | m_Offset: {x: 0, y: 0}
36 | - _DetailMask:
37 | m_Texture: {fileID: 0}
38 | m_Scale: {x: 1, y: 1}
39 | m_Offset: {x: 0, y: 0}
40 | - _DetailNormalMap:
41 | m_Texture: {fileID: 0}
42 | m_Scale: {x: 1, y: 1}
43 | m_Offset: {x: 0, y: 0}
44 | - _DownTex:
45 | m_Texture: {fileID: 0}
46 | m_Scale: {x: 1, y: 1}
47 | m_Offset: {x: 0, y: 0}
48 | - _EmissionMap:
49 | m_Texture: {fileID: 0}
50 | m_Scale: {x: 1, y: 1}
51 | m_Offset: {x: 0, y: 0}
52 | - _FrontTex:
53 | m_Texture: {fileID: 0}
54 | m_Scale: {x: 1, y: 1}
55 | m_Offset: {x: 0, y: 0}
56 | - _LeftTex:
57 | m_Texture: {fileID: 0}
58 | m_Scale: {x: 1, y: 1}
59 | m_Offset: {x: 0, y: 0}
60 | - _MainTex:
61 | m_Texture: {fileID: 0}
62 | m_Scale: {x: 1, y: 1}
63 | m_Offset: {x: 0, y: 0}
64 | - _MetallicGlossMap:
65 | m_Texture: {fileID: 0}
66 | m_Scale: {x: 1, y: 1}
67 | m_Offset: {x: 0, y: 0}
68 | - _OcclusionMap:
69 | m_Texture: {fileID: 0}
70 | m_Scale: {x: 1, y: 1}
71 | m_Offset: {x: 0, y: 0}
72 | - _ParallaxMap:
73 | m_Texture: {fileID: 0}
74 | m_Scale: {x: 1, y: 1}
75 | m_Offset: {x: 0, y: 0}
76 | - _RightTex:
77 | m_Texture: {fileID: 0}
78 | m_Scale: {x: 1, y: 1}
79 | m_Offset: {x: 0, y: 0}
80 | - _UpTex:
81 | m_Texture: {fileID: 0}
82 | m_Scale: {x: 1, y: 1}
83 | m_Offset: {x: 0, y: 0}
84 | m_Ints: []
85 | m_Floats:
86 | - _AtmosphereThickness: 0.9
87 | - _BumpScale: 1
88 | - _Cutoff: 0.5
89 | - _DetailNormalMapScale: 1
90 | - _DstBlend: 0
91 | - _Exposure: 0.7
92 | - _GlossMapScale: 1
93 | - _Glossiness: 0.5
94 | - _GlossyReflections: 1
95 | - _Metallic: 0
96 | - _Mode: 0
97 | - _OcclusionStrength: 1
98 | - _Parallax: 0.02
99 | - _SmoothnessTextureChannel: 0
100 | - _SpecularHighlights: 1
101 | - _SrcBlend: 1
102 | - _SunDisk: 2
103 | - _SunSize: 0.064
104 | - _SunSizeConvergence: 1
105 | - _UVSec: 0
106 | - _ZWrite: 1
107 | m_Colors:
108 | - _Color: {r: 1, g: 1, b: 1, a: 1}
109 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
110 | - _GroundColor: {r: 0.1981132, g: 0.1981132, b: 0.1981132, a: 1}
111 | - _SkyTint: {r: 0.7264151, g: 0.7264151, b: 0.7264151, a: 1}
112 | m_BuildTextureStacks: []
113 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/BetterSkybox.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9040e7c63d316f40a11b301a49b2d68
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/DefaultGround.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: DefaultGround
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords: []
13 | m_InvalidKeywords: []
14 | m_LightmapFlags: 4
15 | m_EnableInstancingVariants: 0
16 | m_DoubleSidedGI: 0
17 | m_CustomRenderQueue: -1
18 | stringTagMap: {}
19 | disabledShaderPasses: []
20 | m_SavedProperties:
21 | serializedVersion: 3
22 | m_TexEnvs:
23 | - _BumpMap:
24 | m_Texture: {fileID: 0}
25 | m_Scale: {x: 1, y: 1}
26 | m_Offset: {x: 0, y: 0}
27 | - _DetailAlbedoMap:
28 | m_Texture: {fileID: 0}
29 | m_Scale: {x: 1, y: 1}
30 | m_Offset: {x: 0, y: 0}
31 | - _DetailMask:
32 | m_Texture: {fileID: 0}
33 | m_Scale: {x: 1, y: 1}
34 | m_Offset: {x: 0, y: 0}
35 | - _DetailNormalMap:
36 | m_Texture: {fileID: 0}
37 | m_Scale: {x: 1, y: 1}
38 | m_Offset: {x: 0, y: 0}
39 | - _EmissionMap:
40 | m_Texture: {fileID: 0}
41 | m_Scale: {x: 1, y: 1}
42 | m_Offset: {x: 0, y: 0}
43 | - _MainTex:
44 | m_Texture: {fileID: 0}
45 | m_Scale: {x: 1, y: 1}
46 | m_Offset: {x: 0, y: 0}
47 | - _MetallicGlossMap:
48 | m_Texture: {fileID: 0}
49 | m_Scale: {x: 1, y: 1}
50 | m_Offset: {x: 0, y: 0}
51 | - _OcclusionMap:
52 | m_Texture: {fileID: 0}
53 | m_Scale: {x: 1, y: 1}
54 | m_Offset: {x: 0, y: 0}
55 | - _ParallaxMap:
56 | m_Texture: {fileID: 0}
57 | m_Scale: {x: 1, y: 1}
58 | m_Offset: {x: 0, y: 0}
59 | m_Ints: []
60 | m_Floats:
61 | - _BumpScale: 1
62 | - _Cutoff: 0.5
63 | - _DetailNormalMapScale: 1
64 | - _DstBlend: 0
65 | - _GlossMapScale: 1
66 | - _Glossiness: 1
67 | - _GlossyReflections: 1
68 | - _Metallic: 0.728
69 | - _Mode: 0
70 | - _OcclusionStrength: 1
71 | - _Parallax: 0.02
72 | - _SmoothnessTextureChannel: 0
73 | - _SpecularHighlights: 1
74 | - _SrcBlend: 1
75 | - _UVSec: 0
76 | - _ZWrite: 1
77 | m_Colors:
78 | - _Color: {r: 0.1981132, g: 0.1981132, b: 0.1981132, a: 1}
79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
80 | m_BuildTextureStacks: []
81 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/DefaultGround.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5aa0f46a34510242abb3d587544cae3
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/DefaultObject.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 8
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: DefaultObject
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ValidKeywords: []
13 | m_InvalidKeywords: []
14 | m_LightmapFlags: 4
15 | m_EnableInstancingVariants: 0
16 | m_DoubleSidedGI: 0
17 | m_CustomRenderQueue: -1
18 | stringTagMap: {}
19 | disabledShaderPasses: []
20 | m_SavedProperties:
21 | serializedVersion: 3
22 | m_TexEnvs:
23 | - _BumpMap:
24 | m_Texture: {fileID: 0}
25 | m_Scale: {x: 1, y: 1}
26 | m_Offset: {x: 0, y: 0}
27 | - _DetailAlbedoMap:
28 | m_Texture: {fileID: 0}
29 | m_Scale: {x: 1, y: 1}
30 | m_Offset: {x: 0, y: 0}
31 | - _DetailMask:
32 | m_Texture: {fileID: 0}
33 | m_Scale: {x: 1, y: 1}
34 | m_Offset: {x: 0, y: 0}
35 | - _DetailNormalMap:
36 | m_Texture: {fileID: 0}
37 | m_Scale: {x: 1, y: 1}
38 | m_Offset: {x: 0, y: 0}
39 | - _EmissionMap:
40 | m_Texture: {fileID: 0}
41 | m_Scale: {x: 1, y: 1}
42 | m_Offset: {x: 0, y: 0}
43 | - _MainTex:
44 | m_Texture: {fileID: 0}
45 | m_Scale: {x: 1, y: 1}
46 | m_Offset: {x: 0, y: 0}
47 | - _MetallicGlossMap:
48 | m_Texture: {fileID: 0}
49 | m_Scale: {x: 1, y: 1}
50 | m_Offset: {x: 0, y: 0}
51 | - _OcclusionMap:
52 | m_Texture: {fileID: 0}
53 | m_Scale: {x: 1, y: 1}
54 | m_Offset: {x: 0, y: 0}
55 | - _ParallaxMap:
56 | m_Texture: {fileID: 0}
57 | m_Scale: {x: 1, y: 1}
58 | m_Offset: {x: 0, y: 0}
59 | m_Ints: []
60 | m_Floats:
61 | - _BumpScale: 1
62 | - _Cutoff: 0.5
63 | - _DetailNormalMapScale: 1
64 | - _DstBlend: 0
65 | - _GlossMapScale: 1
66 | - _Glossiness: 0
67 | - _GlossyReflections: 1
68 | - _Metallic: 0.675
69 | - _Mode: 0
70 | - _OcclusionStrength: 1
71 | - _Parallax: 0.02
72 | - _SmoothnessTextureChannel: 0
73 | - _SpecularHighlights: 1
74 | - _SrcBlend: 1
75 | - _UVSec: 0
76 | - _ZWrite: 1
77 | m_Colors:
78 | - _Color: {r: 1, g: 0.83581686, b: 0, a: 1}
79 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
80 | m_BuildTextureStacks: []
81 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/DefaultObject.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 48e5d06fdf3c4cf40abdded96f84246b
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/NonBlindingWhite.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: NonBlindingWhite
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.745283, g: 0.52015734, b: 0.03163936, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 | m_BuildTextureStacks: []
79 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/NonBlindingWhite.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9f8b2577070bbbf4c9a2a16e33d3d40d
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/black.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: black
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.944
65 | - _GlossyReflections: 1
66 | - _Metallic: 0.408
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.2830189, g: 0.2830189, b: 0.2830189, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 | m_BuildTextureStacks: []
79 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/BetterScene/Materials/black.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eb30b1aade8c3074abf39db503a99316
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 0
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/testScene.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 9
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_IndirectSpecularColor: {r: 0.1801959, g: 0.22071801, b: 0.2785804, a: 1}
42 | m_UseRadianceAmbientProbe: 0
43 | --- !u!157 &3
44 | LightmapSettings:
45 | m_ObjectHideFlags: 0
46 | serializedVersion: 12
47 | m_GIWorkflowMode: 1
48 | m_GISettings:
49 | serializedVersion: 2
50 | m_BounceScale: 1
51 | m_IndirectOutputScale: 1
52 | m_AlbedoBoost: 1
53 | m_EnvironmentLightingMode: 0
54 | m_EnableBakedLightmaps: 1
55 | m_EnableRealtimeLightmaps: 0
56 | m_LightmapEditorSettings:
57 | serializedVersion: 12
58 | m_Resolution: 2
59 | m_BakeResolution: 40
60 | m_AtlasSize: 1024
61 | m_AO: 0
62 | m_AOMaxDistance: 1
63 | m_CompAOExponent: 1
64 | m_CompAOExponentDirect: 0
65 | m_ExtractAmbientOcclusion: 0
66 | m_Padding: 2
67 | m_LightmapParameters: {fileID: 0}
68 | m_LightmapsBakeMode: 1
69 | m_TextureCompression: 1
70 | m_FinalGather: 0
71 | m_FinalGatherFiltering: 1
72 | m_FinalGatherRayCount: 256
73 | m_ReflectionCompression: 2
74 | m_MixedBakeMode: 2
75 | m_BakeBackend: 1
76 | m_PVRSampling: 1
77 | m_PVRDirectSampleCount: 32
78 | m_PVRSampleCount: 512
79 | m_PVRBounces: 2
80 | m_PVREnvironmentSampleCount: 256
81 | m_PVREnvironmentReferencePointCount: 2048
82 | m_PVRFilteringMode: 1
83 | m_PVRDenoiserTypeDirect: 1
84 | m_PVRDenoiserTypeIndirect: 1
85 | m_PVRDenoiserTypeAO: 1
86 | m_PVRFilterTypeDirect: 0
87 | m_PVRFilterTypeIndirect: 0
88 | m_PVRFilterTypeAO: 0
89 | m_PVREnvironmentMIS: 1
90 | m_PVRCulling: 1
91 | m_PVRFilteringGaussRadiusDirect: 1
92 | m_PVRFilteringGaussRadiusIndirect: 5
93 | m_PVRFilteringGaussRadiusAO: 2
94 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
95 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
96 | m_PVRFilteringAtrousPositionSigmaAO: 1
97 | m_ExportTrainingData: 0
98 | m_TrainingDataDestination: TrainingData
99 | m_LightProbeSampleCountMultiplier: 4
100 | m_LightingDataAsset: {fileID: 0}
101 | m_LightingSettings: {fileID: 0}
102 | --- !u!196 &4
103 | NavMeshSettings:
104 | serializedVersion: 2
105 | m_ObjectHideFlags: 0
106 | m_BuildSettings:
107 | serializedVersion: 2
108 | agentTypeID: 0
109 | agentRadius: 0.5
110 | agentHeight: 2
111 | agentSlope: 45
112 | agentClimb: 0.4
113 | ledgeDropHeight: 0
114 | maxJumpAcrossDistance: 0
115 | minRegionArea: 2
116 | manualCellSize: 0
117 | cellSize: 0.16666667
118 | manualTileSize: 0
119 | tileSize: 256
120 | accuratePlacement: 0
121 | maxJobWorkers: 0
122 | preserveTilesOutsideBounds: 0
123 | debug:
124 | m_Flags: 0
125 | m_NavMeshData: {fileID: 0}
126 | --- !u!1 &2056651134
127 | GameObject:
128 | m_ObjectHideFlags: 0
129 | m_CorrespondingSourceObject: {fileID: 0}
130 | m_PrefabInstance: {fileID: 0}
131 | m_PrefabAsset: {fileID: 0}
132 | serializedVersion: 6
133 | m_Component:
134 | - component: {fileID: 2056651136}
135 | - component: {fileID: 2056651135}
136 | m_Layer: 0
137 | m_Name: Directional Light
138 | m_TagString: Untagged
139 | m_Icon: {fileID: 0}
140 | m_NavMeshLayer: 0
141 | m_StaticEditorFlags: 0
142 | m_IsActive: 1
143 | --- !u!108 &2056651135
144 | Light:
145 | m_ObjectHideFlags: 0
146 | m_CorrespondingSourceObject: {fileID: 0}
147 | m_PrefabInstance: {fileID: 0}
148 | m_PrefabAsset: {fileID: 0}
149 | m_GameObject: {fileID: 2056651134}
150 | m_Enabled: 1
151 | serializedVersion: 10
152 | m_Type: 1
153 | m_Shape: 0
154 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
155 | m_Intensity: 1
156 | m_Range: 10
157 | m_SpotAngle: 30
158 | m_InnerSpotAngle: 21.80208
159 | m_CookieSize: 10
160 | m_Shadows:
161 | m_Type: 2
162 | m_Resolution: -1
163 | m_CustomResolution: -1
164 | m_Strength: 1
165 | m_Bias: 0.05
166 | m_NormalBias: 0.4
167 | m_NearPlane: 0.2
168 | m_CullingMatrixOverride:
169 | e00: 1
170 | e01: 0
171 | e02: 0
172 | e03: 0
173 | e10: 0
174 | e11: 1
175 | e12: 0
176 | e13: 0
177 | e20: 0
178 | e21: 0
179 | e22: 1
180 | e23: 0
181 | e30: 0
182 | e31: 0
183 | e32: 0
184 | e33: 1
185 | m_UseCullingMatrixOverride: 0
186 | m_Cookie: {fileID: 0}
187 | m_DrawHalo: 0
188 | m_Flare: {fileID: 0}
189 | m_RenderMode: 0
190 | m_CullingMask:
191 | serializedVersion: 2
192 | m_Bits: 4294967295
193 | m_RenderingLayerMask: 1
194 | m_Lightmapping: 4
195 | m_LightShadowCasterMode: 0
196 | m_AreaSize: {x: 1, y: 1}
197 | m_BounceIntensity: 1
198 | m_ColorTemperature: 6570
199 | m_UseColorTemperature: 0
200 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
201 | m_UseBoundingSphereOverride: 0
202 | m_UseViewFrustumForShadowCasterCull: 1
203 | m_ShadowRadius: 0
204 | m_ShadowAngle: 0
205 | --- !u!4 &2056651136
206 | Transform:
207 | m_ObjectHideFlags: 0
208 | m_CorrespondingSourceObject: {fileID: 0}
209 | m_PrefabInstance: {fileID: 0}
210 | m_PrefabAsset: {fileID: 0}
211 | m_GameObject: {fileID: 2056651134}
212 | m_LocalRotation: {x: 0.111914486, y: -0.18821697, z: 0.1776562, w: 0.95942056}
213 | m_LocalPosition: {x: 0, y: 3, z: 0}
214 | m_LocalScale: {x: 1, y: 1, z: 1}
215 | m_ConstrainProportionsScale: 0
216 | m_Children: []
217 | m_Father: {fileID: 0}
218 | m_RootOrder: 1
219 | m_LocalEulerAnglesHint: {x: 16.357, y: -19.57, z: 18.142}
220 | --- !u!1 &2092450759
221 | GameObject:
222 | m_ObjectHideFlags: 0
223 | m_CorrespondingSourceObject: {fileID: 0}
224 | m_PrefabInstance: {fileID: 0}
225 | m_PrefabAsset: {fileID: 0}
226 | serializedVersion: 6
227 | m_Component:
228 | - component: {fileID: 2092450762}
229 | - component: {fileID: 2092450761}
230 | - component: {fileID: 2092450760}
231 | m_Layer: 0
232 | m_Name: Main Camera
233 | m_TagString: MainCamera
234 | m_Icon: {fileID: 0}
235 | m_NavMeshLayer: 0
236 | m_StaticEditorFlags: 0
237 | m_IsActive: 1
238 | --- !u!81 &2092450760
239 | AudioListener:
240 | m_ObjectHideFlags: 0
241 | m_CorrespondingSourceObject: {fileID: 0}
242 | m_PrefabInstance: {fileID: 0}
243 | m_PrefabAsset: {fileID: 0}
244 | m_GameObject: {fileID: 2092450759}
245 | m_Enabled: 1
246 | --- !u!20 &2092450761
247 | Camera:
248 | m_ObjectHideFlags: 0
249 | m_CorrespondingSourceObject: {fileID: 0}
250 | m_PrefabInstance: {fileID: 0}
251 | m_PrefabAsset: {fileID: 0}
252 | m_GameObject: {fileID: 2092450759}
253 | m_Enabled: 1
254 | serializedVersion: 2
255 | m_ClearFlags: 1
256 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
257 | m_projectionMatrixMode: 1
258 | m_GateFitMode: 2
259 | m_FOVAxisMode: 0
260 | m_SensorSize: {x: 36, y: 24}
261 | m_LensShift: {x: 0, y: 0}
262 | m_FocalLength: 50
263 | m_NormalizedViewPortRect:
264 | serializedVersion: 2
265 | x: 0
266 | y: 0
267 | width: 1
268 | height: 1
269 | near clip plane: 0.3
270 | far clip plane: 1000
271 | field of view: 60
272 | orthographic: 0
273 | orthographic size: 5
274 | m_Depth: -1
275 | m_CullingMask:
276 | serializedVersion: 2
277 | m_Bits: 4294967295
278 | m_RenderingPath: -1
279 | m_TargetTexture: {fileID: 0}
280 | m_TargetDisplay: 0
281 | m_TargetEye: 3
282 | m_HDR: 1
283 | m_AllowMSAA: 1
284 | m_AllowDynamicResolution: 0
285 | m_ForceIntoRT: 0
286 | m_OcclusionCulling: 1
287 | m_StereoConvergence: 10
288 | m_StereoSeparation: 0.022
289 | --- !u!4 &2092450762
290 | Transform:
291 | m_ObjectHideFlags: 0
292 | m_CorrespondingSourceObject: {fileID: 0}
293 | m_PrefabInstance: {fileID: 0}
294 | m_PrefabAsset: {fileID: 0}
295 | m_GameObject: {fileID: 2092450759}
296 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
297 | m_LocalPosition: {x: 0, y: 1, z: -10}
298 | m_LocalScale: {x: 1, y: 1, z: 1}
299 | m_ConstrainProportionsScale: 0
300 | m_Children: []
301 | m_Father: {fileID: 0}
302 | m_RootOrder: 0
303 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
304 |
--------------------------------------------------------------------------------
/Samples~/BetterScenes/testScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 219f5b7d3a02ad4478df0162e17f1d3f
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/betterunity.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "betterunity"
3 | }
4 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.sudotman.betterunity",
3 | "displayName": "BetterUnity",
4 | "version": "0.9.2",
5 | "description": "A package consisting of shaders, scripts and inspector modifications to aid in development.",
6 | "license": "MIT",
7 | "author": {
8 | "name": "Satyam Kashyap",
9 | "email": "satyamsudo@gmail.com",
10 | "url": "https://sudotman.github.io/"
11 | },
12 | "documentationUrl": "https://github.com/sudotman/BetterUnity/blob/main/README.md#contents--documentation",
13 | "keywords": [
14 | "scripts",
15 | "inspector",
16 | "modifications",
17 | "shaders"
18 | ],
19 | "category": "Scripts",
20 | "samples": [
21 | {
22 | "displayName": "BetterScenes",
23 | "description": "Contains a 1. NavigationSample scene and 2. a pre-configured scene with post-processing enabled - a basic plane surface - a non generic skybox - two basic materials",
24 | "path": "Samples~/BetterScenes"
25 | }
26 | ]
27 |
28 | }
29 |
--------------------------------------------------------------------------------