Author Topic: Problem attaching Atlas to Widget Tool  (Read 2979 times)

Dave88

  • Guest
Problem attaching Atlas to Widget Tool
« on: May 07, 2013, 09:10:41 AM »
Hi,

I tried to make a GUI with NGUI and created a UI without a problem, but when I try to attach a Atlas to the Widget Tool I can't attach it. I just get this Error:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorGUI.ValidateObjectFieldAssignment (UnityEngine.Object[] references, System.Type objType, UnityEditor.SerializedProperty property) (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/EditorGUI.cs:1941)
UnityEditor.EditorGUI.DoObjectField (Rect position, Rect dropRect, Int32 id, UnityEngine.Object obj, System.Type objType, UnityEditor.SerializedProperty property, UnityEditor.ObjectFieldValidator validator, Boolean allowSceneObjects, UnityEngine.GUIStyle style) (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/GUI/ObjectField.cs:39)
UnityEditor.EditorGUI.DoObjectField (Rect position, Rect dropRect, Int32 id, UnityEngine.Object obj, System.Type objType, UnityEditor.SerializedProperty property, UnityEditor.ObjectFieldValidator validator, Boolean allowSceneObjects) (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/GUI/ObjectField.cs:12)
UnityEditor.EditorGUI.ObjectField (Rect position, UnityEngine.Object obj, System.Type objType, Boolean allowSceneObjects) (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/EditorGUI.cs:1893)
UnityEditor.EditorGUILayout.ObjectField (UnityEngine.Object obj, System.Type objType, Boolean allowSceneObjects, UnityEngine.GUILayoutOption[] options) (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/EditorGUI.cs:3735)
ComponentSelector.Draw[UIAtlas] (System.String buttonName, .UIAtlas obj, .OnSelectionCallback cb, UnityEngine.GUILayoutOption[] options) (at Assets/NGUI_2013/Scripts/Editor/ComponentSelector.cs:35)
ComponentSelector.Draw[UIAtlas] (.UIAtlas obj, .OnSelectionCallback cb, UnityEngine.GUILayoutOption[] options) (at Assets/NGUI_2013/Scripts/Editor/ComponentSelector.cs:54)
UICreateWidgetWizard.OnGUI () (at Assets/NGUI_2013/Scripts/Editor/UICreateWidgetWizard.cs:746)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

thanks for helping :)

Abnaxus

  • Guest
Re: Problem attaching Atlas to Widget Tool
« Reply #1 on: May 07, 2013, 09:28:36 AM »
Working with editor or via script ?

If it's script, can you post your code please ? (Easier to help.)

Dave88

  • Guest
Re: Problem attaching Atlas to Widget Tool
« Reply #2 on: May 07, 2013, 09:58:21 AM »
I'm working with the editor. There I couldn't even make the first Tutorial...

Abnaxus

  • Guest
Re: Problem attaching Atlas to Widget Tool
« Reply #3 on: May 07, 2013, 10:08:31 AM »
With Editor:

First create your UI.
Then create a Panel in your UI (it creates one by default on middle Anchor though).
Then create a Widget and put it as Child of you Panel.

Everything should work well.

If it doesn't, can you take a screenshot of your Unity Project so we can easily see what's going wrong ?

EDIT: I guess what you're doing wrong is that your not Dragging&Dropping the prefab of the atlas, but the atlas image/material instead.
Correct me if I'm wrong.

Dave88

  • Guest
Re: Problem attaching Atlas to Widget Tool
« Reply #4 on: May 07, 2013, 10:20:05 AM »
I tried to drag the SciFi Atlas into the Widget tool and just got the error

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem attaching Atlas to Widget Tool
« Reply #5 on: May 07, 2013, 04:27:07 PM »
Why is the material for your atlas showing up as pink? This implies the shader wasn't loaded. Something is wrong with your NGUI installation. I advise re-installing it.