Răsfoiți Sursa

Bugfix: GUIContent struct should be passed to native code by reference, not by value

BearishSun 7 ani în urmă
părinte
comite
f7a634f4fd

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIColorField.cs

@@ -50,7 +50,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIColorField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -63,7 +63,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIColorField(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -103,7 +104,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIColorField instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUIColorField instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 9 - 7
Source/Scripting/MBansheeEditor/GUI/GUIEnumField.cs

@@ -58,7 +58,7 @@ namespace BansheeEditor
         public GUIEnumField(Type enumType, bool multiselect, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
             Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect,
-                title, titleWidth, style, options, true);
+                ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -74,7 +74,7 @@ namespace BansheeEditor
         public GUIEnumField(Type enumType, bool multiselect, GUIContent title, int titleWidth, params GUIOption[] options)
         {
             Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect,
-                title, titleWidth, "", options, true);
+                ref title, titleWidth, "", options, true);
         }
 
         /// <summary>
@@ -91,7 +91,7 @@ namespace BansheeEditor
         public GUIEnumField(Type enumType, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
             Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), false,
-                title, titleWidth, style, options, true);
+                ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -105,7 +105,7 @@ namespace BansheeEditor
         public GUIEnumField(Type enumType, GUIContent title, int titleWidth, params GUIOption[] options)
         {
             Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), false, 
-                title, titleWidth, "", options, true);
+                ref title, titleWidth, "", options, true);
         }
 
         /// <summary>
@@ -121,8 +121,9 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIEnumField(Type enumType, bool multiselect, string style = "", params GUIOption[] options)
         {
+            GUIContent emptyContent = new GUIContent();
             Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect, 
-                new GUIContent(), 0, style, options, false);
+                ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -135,8 +136,9 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIEnumField(Type enumType, bool multiselect = false, params GUIOption[] options)
         {
+            GUIContent emptyContent = new GUIContent();
             Internal_CreateInstance(this, Enum.GetNames(enumType), Enum.GetValues(enumType), multiselect, 
-                new GUIContent(), 0, "", options, false);
+                ref emptyContent, 0, "", options, false);
         }
 
         /// <summary>
@@ -177,7 +179,7 @@ namespace BansheeEditor
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_CreateInstance(GUIEnumField instance, string[] names, Array values, 
-            bool multiselect, GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
+            bool multiselect, ref GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern UInt64 Internal_GetValue(IntPtr nativeInstance);

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIFloatField.cs

@@ -66,7 +66,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIFloatField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -79,7 +79,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIFloatField(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -122,7 +123,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIFloatField instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUIFloatField instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 5 - 4
Source/Scripting/MBansheeEditor/GUI/GUIGameObjectField.cs

@@ -51,7 +51,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIGameObjectField(Type type, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, type, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, type, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -65,7 +65,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIGameObjectField(Type type, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, type, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, type, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -88,8 +89,8 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIGameObjectField instance, Type type, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
+        private static extern void Internal_CreateInstance(GUIGameObjectField instance, Type type, ref GUIContent title, 
+            int titleWidth, string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetValue(IntPtr nativeInstance, out GameObject value);

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIIntField.cs

@@ -66,7 +66,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIIntField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -79,7 +79,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIIntField(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -122,7 +123,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIIntField instance, GUIContent title, int titleWidth, 
+        private static extern void Internal_CreateInstance(GUIIntField instance, ref GUIContent title, int titleWidth, 
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 18 - 13
Source/Scripting/MBansheeEditor/GUI/GUIListBoxField.cs

@@ -60,7 +60,7 @@ namespace BansheeEditor
         public GUIListBoxField(LocString[] elements, bool multiselect, GUIContent title, int titleWidth, string style = "",
             params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, multiselect, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, elements, multiselect, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -76,7 +76,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(LocString[] elements, bool multiselect, GUIContent title, int titleWidth = 100, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, multiselect, title, titleWidth, "", options, true);
+            Internal_CreateInstance(this, elements, multiselect, ref title, titleWidth, "", options, true);
         }
 
         /// <summary>
@@ -94,7 +94,7 @@ namespace BansheeEditor
         public GUIListBoxField(LocString[] elements, GUIContent title, int titleWidth, string style = "", 
             params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, false, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, elements, false, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -108,7 +108,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(LocString[] elements, GUIContent title, int titleWidth = 100, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, false, title, titleWidth, "", options, true);
+            Internal_CreateInstance(this, elements, false, ref title, titleWidth, "", options, true);
         }
 
         /// <summary>
@@ -125,7 +125,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(LocString[] elements, bool multiselect = false, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, multiselect, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, elements, multiselect, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -139,7 +140,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(LocString[] elements, bool multiselect = false, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, multiselect, new GUIContent(), 0, "", options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, elements, multiselect, ref emptyContent, 0, "", options, false);
         }
 
         /// <summary>
@@ -159,7 +161,7 @@ namespace BansheeEditor
         public GUIListBoxField(string[] elements, bool multiselect, GUIContent title, int titleWidth, string style = "",
             params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -175,7 +177,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(string[] elements, bool multiselect, GUIContent title, int titleWidth = 100, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, title, titleWidth, "", options, true);
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, ref title, titleWidth, "", options, true);
         }
 
         /// <summary>
@@ -193,7 +195,7 @@ namespace BansheeEditor
         public GUIListBoxField(string[] elements, GUIContent title, int titleWidth, string style = "",
             params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), false, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ToLocalizedElements(elements), false, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -207,7 +209,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(string[] elements, GUIContent title, int titleWidth = 100, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), false, title, titleWidth, "", options, true);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ToLocalizedElements(elements), false, ref emptyContent, titleWidth, "", options, true);
         }
 
         /// <summary>
@@ -224,7 +227,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(string[] elements, bool multiselect = false, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -238,7 +242,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIListBoxField(string[] elements, bool multiselect = false, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, new GUIContent(), 0, "", options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ToLocalizedElements(elements), multiselect, ref emptyContent, 0, "", options, false);
         }
 
         /// <summary>
@@ -316,7 +321,7 @@ namespace BansheeEditor
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_CreateInstance(GUIListBoxField instance, LocString[] entries, bool multiselect,
-            GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
+            ref GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetElements(IntPtr nativeInstance, LocString[] elements);

+ 5 - 4
Source/Scripting/MBansheeEditor/GUI/GUIResourceField.cs

@@ -67,7 +67,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIResourceField(Type type, GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, type, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, type, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -81,7 +81,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIResourceField(Type type, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, type, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, type, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -104,8 +105,8 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIResourceField instance, Type type, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
+        private static extern void Internal_CreateInstance(GUIResourceField instance, Type type, ref GUIContent title, 
+            int titleWidth, string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetValue(IntPtr nativeInstance, out Resource value);

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUISliderField.cs

@@ -56,7 +56,7 @@ namespace BansheeEditor
         public GUISliderField(float min, float max, GUIContent title, int titleWidth = 100, 
             string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, min, max, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, min, max, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -71,7 +71,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUISliderField(float min, float max, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, min, max, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, min, max, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -120,7 +121,7 @@ namespace BansheeEditor
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_CreateInstance(GUISliderField instance, float min, float max, 
-            GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
+            ref GUIContent title, int titleWidth, string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern float Internal_GetValue(IntPtr nativeInstance);

+ 5 - 4
Source/Scripting/MBansheeEditor/GUI/GUITextField.cs

@@ -67,7 +67,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUITextField(GUIContent title, int titleWidth = 100, bool multiline = false, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, multiline, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, multiline, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -81,7 +81,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUITextField(bool multiline = false, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, multiline, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, multiline, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -113,8 +114,8 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUITextField instance, bool multiline, GUIContent title, int titleWidth,
-            string style, GUIOption[] options, bool withTitle);
+        private static extern void Internal_CreateInstance(GUITextField instance, bool multiline, ref GUIContent title, 
+            int titleWidth, string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_GetValue(IntPtr nativeInstance, out String value);

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUITextureField.cs

@@ -67,7 +67,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUITextureField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -80,7 +80,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUITextureField(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -103,7 +104,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUITextureField instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUITextureField instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIToggleField.cs

@@ -49,7 +49,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIToggleField(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -62,7 +62,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIToggleField(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -85,7 +86,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIToggleField instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUIToggleField instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIVector2Field.cs

@@ -66,7 +66,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIVector2Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -79,7 +79,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIVector2Field(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -111,7 +112,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIVector2Field instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUIVector2Field instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIVector3Field.cs

@@ -66,7 +66,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIVector3Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -79,7 +79,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIVector3Field(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -111,7 +112,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIVector3Field instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUIVector3Field instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 4 - 3
Source/Scripting/MBansheeEditor/GUI/GUIVector4Field.cs

@@ -66,7 +66,7 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIVector4Field(GUIContent title, int titleWidth = 100, string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, title, titleWidth, style, options, true);
+            Internal_CreateInstance(this, ref title, titleWidth, style, options, true);
         }
 
         /// <summary>
@@ -79,7 +79,8 @@ namespace BansheeEditor
         ///                       override any similar options set by style.</param>
         public GUIVector4Field(string style = "", params GUIOption[] options)
         {
-            Internal_CreateInstance(this, new GUIContent(), 0, style, options, false);
+            GUIContent emptyContent = new GUIContent();
+            Internal_CreateInstance(this, ref emptyContent, 0, style, options, false);
         }
 
         /// <summary>
@@ -111,7 +112,7 @@ namespace BansheeEditor
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIVector4Field instance, GUIContent title, int titleWidth,
+        private static extern void Internal_CreateInstance(GUIVector4Field instance, ref GUIContent title, int titleWidth,
             string style, GUIOption[] options, bool withTitle);
 
         [MethodImpl(MethodImplOptions.InternalCall)]

+ 6 - 6
Source/Scripting/MBansheeEngine/GUI/GUIButton.cs

@@ -50,7 +50,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUIButton(GUIContent content, string style, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, style, options);
+            Internal_CreateInstance(this, ref content, style, options);
         }
 
         /// <summary>
@@ -62,7 +62,7 @@ namespace BansheeEngine
         ///                     default element style is used.</param>
         public GUIButton(GUIContent content, string style)
         {
-            Internal_CreateInstance(this, content, style, new GUIOption[0]);
+            Internal_CreateInstance(this, ref content, style, new GUIOption[0]);
         }
 
         /// <summary>
@@ -73,7 +73,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUIButton(GUIContent content, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, "", options);
+            Internal_CreateInstance(this, ref content, "", options);
         }
 
         /// <summary>
@@ -82,7 +82,7 @@ namespace BansheeEngine
         /// <param name="content">Content to display on the button.</param>
         public void SetContent(GUIContent content)
         {
-            Internal_SetContent(mCachedPtr, content);
+            Internal_SetContent(mCachedPtr, ref content);
         }
 
         /// <summary>
@@ -131,11 +131,11 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIButton instance, GUIContent content, string style, 
+        private static extern void Internal_CreateInstance(GUIButton instance, ref GUIContent content, string style, 
             GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
+        private static extern void Internal_SetContent(IntPtr nativeInstance, ref GUIContent content);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);

+ 6 - 6
Source/Scripting/MBansheeEngine/GUI/GUILabel.cs

@@ -25,7 +25,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUILabel(GUIContent content, string style, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, style, options);
+            Internal_CreateInstance(this, ref content, style, options);
         }
 
         /// <summary>
@@ -37,7 +37,7 @@ namespace BansheeEngine
         ///                     default element style is used.</param>
         public GUILabel(GUIContent content, string style = "")
         {
-            Internal_CreateInstance(this, content, style, new GUIOption[0]);
+            Internal_CreateInstance(this, ref content, style, new GUIOption[0]);
         }
 
         /// <summary>
@@ -48,7 +48,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUILabel(GUIContent content, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, "", options);
+            Internal_CreateInstance(this, ref content, "", options);
         }
 
         /// <summary>
@@ -57,7 +57,7 @@ namespace BansheeEngine
         /// <param name="content">Content to display on the label.</param>
         public void SetContent(GUIContent content)
         {
-            Internal_SetContent(mCachedPtr, content);
+            Internal_SetContent(mCachedPtr, ref content);
         }
 
         /// <summary>
@@ -70,11 +70,11 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUILabel instance, GUIContent content, string style, 
+        private static extern void Internal_CreateInstance(GUILabel instance, ref GUIContent content, string style, 
             GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
+        private static extern void Internal_SetContent(IntPtr nativeInstance, ref GUIContent content);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTint(IntPtr nativeInstance, ref Color color);

+ 9 - 9
Source/Scripting/MBansheeEngine/GUI/GUIToggle.cs

@@ -48,7 +48,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, string style, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, toggleGroup, style, options);
+            Internal_CreateInstance(this, ref content, toggleGroup, style, options);
         }
 
         /// <summary>
@@ -62,7 +62,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUIToggle(GUIContent content, string style, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, null, style, options);
+            Internal_CreateInstance(this, ref content, null, style, options);
         }
 
         /// <summary>
@@ -74,7 +74,7 @@ namespace BansheeEngine
         ///                     default element style is used.</param>
         public GUIToggle(GUIContent content, string style)
         {
-            Internal_CreateInstance(this, content, null, style, new GUIOption[0]);
+            Internal_CreateInstance(this, ref content, null, style, new GUIOption[0]);
         }
 
         /// <summary>
@@ -85,7 +85,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUIToggle(GUIContent content, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, null, "", options);
+            Internal_CreateInstance(this, ref content, null, "", options);
         }
 
         /// <summary>
@@ -99,7 +99,7 @@ namespace BansheeEngine
         ///                     default element style is used.</param>
         public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, string style)
         {
-            Internal_CreateInstance(this, content, toggleGroup, style, new GUIOption[0]);
+            Internal_CreateInstance(this, ref content, toggleGroup, style, new GUIOption[0]);
         }
 
         /// <summary>
@@ -112,7 +112,7 @@ namespace BansheeEngine
         ///                       override any similar options set by style.</param>
         public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, toggleGroup, "", options);
+            Internal_CreateInstance(this, ref content, toggleGroup, "", options);
         }
 
         /// <summary>
@@ -121,7 +121,7 @@ namespace BansheeEngine
         /// <param name="content">Content to display on the button.</param>
         public void SetContent(GUIContent content)
         {
-            Internal_SetContent(mCachedPtr, content);
+            Internal_SetContent(mCachedPtr, ref content);
         }
 
         /// <summary>
@@ -180,11 +180,11 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIToggle instance, GUIContent content,
+        private static extern void Internal_CreateInstance(GUIToggle instance, ref GUIContent content,
             GUIToggleGroup toggleGroup, string style, GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);
+        private static extern void Internal_SetContent(IntPtr nativeInstance, ref GUIContent content);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern bool Internal_GetValue(IntPtr nativeInstance);