cybran
May 11, 2020, 12:19pm
1
Hi,
I’m on OSX with Unity version 2019.3.12f1
I’ve been really enjoying the learning so far but now I’ve hit a dead end.
I’ve been following the tutorial fine up until this point:
On step:
2.Create and open a new script file
In this Creator Kit, there is a simple template script that you can use to write item effects. To create and open a new script from the template:
In the top menu, go to Beginner Code > Create Item Effect.
I do it but get the following error .
I then try:
2. Enter a name without spaces (for example, “AddHealthEffect”) and select Create.
but nothing happens :
Finally I check the console and see these 2 errors :
Does anybody have any ideas what the problem could be?
Thank you
PS. the ‘insert image’ forum functionality isn’t working with imgbb
Please copy and include text of the error, rather than posting weird links leading somewhere
Sure, for those who don’t like screenshots…
NullReferenceException: Object reference not set to an instance of an object
NameWindow.OnGUI () (at Assets/Creator Kit - Beginner Code/Scripts/Editor/CreateScriptEditor.cs:178)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:381)
UnityEditor.HostView.Invoke (System.String methodName) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:375)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/HostView.cs:351)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:401)
UnityEditor.DockArea.OldOnGUI () (at /Users/builduser/buildslave/unity/build/Editor/Mono/GUI/DockArea.cs:390)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:293)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:508)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:491)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:484)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:477)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:449)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:77)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Events/MouseCaptureDispatchingStrategy.cs:92)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:310)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:275)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:238)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:203)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:44)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:301)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:159)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/Panel.cs:256)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:404)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:194)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/builduser/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:187)
UnityEditor.EditorWindow:ShowModalUtility()
NameWindow:smile:isplay() (at Assets/Creator Kit - Beginner Code/Scripts/Editor/CreateScriptEditor.cs:164)
CreateScriptEditor:CreateItemEffect() (at Assets/Creator Kit - Beginner Code/Scripts/Editor/CreateScriptEditor.cs:12)
and the other error…
NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorWindow.MakeModal () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorWindow.cs:482)
UnityEditor.EditorWindow.ShowModalUtility () (at /Users/builduser/buildslave/unity/build/Editor/Mono/EditorWindow.cs:494)
NameWindow.Display () (at Assets/Creator Kit - Beginner Code/Scripts/Editor/CreateScriptEditor.cs:164)
CreateScriptEditor.CreateItemEffect () (at Assets/Creator Kit - Beginner Code/Scripts/Editor/CreateScriptEditor.cs:12)
These are just nullrefs. They are unrelated to any specific thing you’re doing. You have a reference that you have failed to initialize. It is the single-most posted-about error. The answer is always the same:
look at the line number in the error, figure out what the reference is that is null
find out who is supposed to initialize it (you in the editor? a piece of code?)
fix why that’s not happening.
’
1 Like
cybran
May 12, 2020, 12:13pm
5
Thanks for the attempt to be helpful.
However, I was always taught not to mess with underlying code.
CreateScriptEditor.cs is a Unity script which seems to be called when I use the menu item Beginner Code → Create Item Effect hence why I raised this as a bug. I have been following the tutorial precisely and everything has been building and running fine up until this point where I was instructed to use this menu.
Thanks anyway.
There seems to be a slight misunderstanding here.
The menu you are referring to I believe isn’t part of standard Unity, but part of a ‘Creator Kit’ that extends Unity’s capabilities for teaching you how to use Unity. Problems with that you should report to learn.Unity.com
You are right now at Unity’s main developer forum, and few here have deep knowledge with regards to how Unity puts together their interactive tuorials - even if some here have been happily using them.
cybran
May 12, 2020, 12:31pm
7
Ahhhh ok, gotcha, that makes total sense now.
Thank you for clearing that up! Appreciate it. Will post in the appropriate place.
Thanks
cybran:
Thanks for the attempt to be helpful.
However, I was always taught not to mess with underlying code.
CreateScriptEditor.cs is a Unity script which seems to be called when I use the menu item Beginner Code → Create Item Effect hence why I raised this as a bug. I have been following the tutorial precisely and everything has been building and running fine up until this point where I was instructed to use this menu.
Thanks anyway.
I have the same issue exactly. The new script file is NOT created properly. I’m stuck here at this point in the tutorial.
Go to the Scripts level in the Project window. There you will find the script we were required to create named as AddHealthUsageEffect .
It already existed… lame I know.
1 Like
Thanks for letting me know, cheers.
1 Like
There is also a tutorial later on requesting the same menu item to be used (Beginner Code - Create Item Effect ). It will bug out of course. They included the script you need called SampleItemEffect .
1 Like