Hi,
I am getting a lot of run-time errors calling it in OnGUI():
public Material mat;
private Rect rect = new Rect(970, 0, 45, 50);
void OnGUI()
{
//...
if (Event.current.type == EventType.Repaint) // doesn't solve run-time errors
{
mat.SetFloat("_Cutoff", 257 - someScript.value_that_increments); Graphics.DrawTexture(rect, mat.mainTexture, mat);
}
//...
}
I need to be using this function…I cannot use GUI.DrawTexture because it does not have a paramater for a material type. Is their a special place where I can call Graphics.DrawTexture so that I don’t experience any run-time errors?
I am using Unity 2.6.1 and getting these errors:
UnityEngine.Graphics:smile:rawTexture(Rect, Texture, Rect, Int32, Int32, Int32, Int32, Color, Material) UnityEngine.Graphics:smile:rawTexture(Rect, Texture, Rect, Int32, Int32, Int32, Int32, Color, Material) UnityEngine.Graphics:smile:rawTexture(Rect, Texture, Rect, Int32, Int32, Int32, Int32, Material) UnityEngine.Graphics:smile:rawTexture(Rect, Texture, Int32, Int32, Int32, Int32, Material) UnityEngine.Graphics:smile:rawTexture(Rect, Texture, Material) PlayerGUI:OnGUI() (at Assets\GUIScripts\PlayerGUI.cs:136) UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean) UnityEditor.EditorGUIUtility:RenderGameViewCameras(Rect, Rect, Boolean, Boolean) UnityEditor.GameView:OnGUI() System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ]) System.Reflection.MonoMethod:InternalInvoke(Object, Object[ ]) System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[ ], CultureInfo) System.Reflection.MethodBase:Invoke(Object, Object[ ]) UnityEditor.HostView:Invoke(String) UnityEditor.MaximizedHostView:OnGUI()