llamacademy / scriptable-object-based-guns

Learn how to create a ScriptableObject-based gun system from scratch for your game!
https://www.youtube.com/watch?v=E-vIMamyORg&list=PLllNmP7eq6TQJjgKJ6FKcNFfRREe_L6to
MIT License
105 stars 25 forks source link

Sample scene errors #17

Open Lyten02 opened 3 months ago

Lyten02 commented 3 months ago

Unity version: Mac silicon 2022.3.4f1 I downloaded the project as a zip file and started the project without doing any other things

  1. NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.GunScriptableObject.GetRaycastOrigin () (at Assets/Scripts/Guns/GunScriptableObject.cs:309) LlamAcademy.Guns.Demo.PlayerAction.UpdateCrosshair () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:46) LlamAcademy.Guns.Demo.PlayerAction.Update () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:41)

  2. NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.GunScriptableObject.TryToShoot () (at Assets/Scripts/Guns/GunScriptableObject.cs:190) LlamAcademy.Guns.GunScriptableObject.Tick (System.Boolean WantsToShoot) (at Assets/Scripts/Guns/GunScriptableObject.cs:125) LlamAcademy.Guns.Demo.PlayerAction.Update () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:26)

  3. NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.Demo.Editors.PlayerActionEditor.OnSceneGUI () (at Assets/Scripts/Guns/Demo/Editor/PlayerActionEditor.cs:28) (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,UnityEditor.Editor) UnityEditor.SceneView.CallOnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:3782) UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2817) UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2485) UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2325) 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/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:355) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190)

There are other errors there, just they are not so critical.

rolandrnf6 commented 3 months ago

I’m confused Sent from my iPhoneOn Mar 11, 2024, at 12:09 PM, Kosty @.***> wrote: Unity version: Mac silicon 2022.3.4f1 I downloaded the project as a zip file and started the project without doing any other things

NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.GunScriptableObject.GetRaycastOrigin () (at Assets/Scripts/Guns/GunScriptableObject.cs:309) LlamAcademy.Guns.Demo.PlayerAction.UpdateCrosshair () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:46) LlamAcademy.Guns.Demo.PlayerAction.Update () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:41)

NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.GunScriptableObject.TryToShoot () (at Assets/Scripts/Guns/GunScriptableObject.cs:190) LlamAcademy.Guns.GunScriptableObject.Tick (System.Boolean WantsToShoot) (at Assets/Scripts/Guns/GunScriptableObject.cs:125) LlamAcademy.Guns.Demo.PlayerAction.Update () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:26)

NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.Demo.Editors.PlayerActionEditor.OnSceneGUI () (at Assets/Scripts/Guns/Demo/Editor/PlayerActionEditor.cs:28) (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,UnityEditor.Editor) UnityEditor.SceneView.CallOnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:3782) UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2817) UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2485) UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2325) 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/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:355) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190) There are other errors there, just they are not so critical.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

rolandrnf6 commented 3 months ago

My bad I didn’t mean to make this public. I’ll put the working version on GitHub soon Sent from my iPhoneOn Mar 11, 2024, at 12:09 PM, Kosty @.***> wrote: Unity version: Mac silicon 2022.3.4f1 I downloaded the project as a zip file and started the project without doing any other things

NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.GunScriptableObject.GetRaycastOrigin () (at Assets/Scripts/Guns/GunScriptableObject.cs:309) LlamAcademy.Guns.Demo.PlayerAction.UpdateCrosshair () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:46) LlamAcademy.Guns.Demo.PlayerAction.Update () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:41)

NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.GunScriptableObject.TryToShoot () (at Assets/Scripts/Guns/GunScriptableObject.cs:190) LlamAcademy.Guns.GunScriptableObject.Tick (System.Boolean WantsToShoot) (at Assets/Scripts/Guns/GunScriptableObject.cs:125) LlamAcademy.Guns.Demo.PlayerAction.Update () (at Assets/Scripts/Guns/Demo/PlayerAction.cs:26)

NullReferenceException: Object reference not set to an instance of an object LlamAcademy.Guns.Demo.Editors.PlayerActionEditor.OnSceneGUI () (at Assets/Scripts/Guns/Demo/Editor/PlayerActionEditor.cs:28) (wrapper dynamic-method) System.Object.lambda_method(System.Runtime.CompilerServices.Closure,UnityEditor.Editor) UnityEditor.SceneView.CallOnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:3782) UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2817) UnityEditor.SceneView.DoOnGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2485) UnityEditor.SceneView.OnSceneGUI () (at /Users/bokken/build/output/unity/unity/Editor/Mono/SceneView/SceneView.cs:2325) 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/bokken/build/output/unity/unity/ModuleOverrides/com.unity.ui/Core/IMGUIContainer.cs:355) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/build/output/unity/unity/Modules/IMGUI/GUIUtility.cs:190) There are other errors there, just they are not so critical.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

llamacademy commented 3 months ago

Hi! Have you followed the setup instructions to ensure you have the Unity Particle Pack installed and have a Particle System at the tip of your gun model? That error is commonly reported when the Unity Particle Pack has not been imported and a Gun model does not have a Particle System as a child.

The rest of your errors all seem to also point to a null reference related to the particle system.

Check the Quickstart on the readme and let me know if you still encounter the issue from there!