weldonla / ARjs_Unity

Apache License 2.0
55 stars 19 forks source link

Unable to add image target #8

Open linatheidiot opened 3 years ago

linatheidiot commented 3 years ago

Hi all, I'm new to AR.js. Unity kept giving me error when I tried to click update on my custom image target files downloaded from the marker trainer. I'm using Unity Version 2019.4.f21. Am I doing something wrong or is there something I need to change in the C# file in Unity ? Kindly help. Thank you in advance.

Full error listed below the screen cap.

Screen Shot 2021-03-03 at 11 27 51 PM

UnityException: Texture 'pattern-stealing stars tracking' is not readable, the texture memory can not be accessed from scripts. You can make the texture readable in the Texture Import Settings. UnityEngine.Texture2D.GetPixel (System.Int32 x, System.Int32 y) (at /Users/bokken/buildslave/unity/build/Runtime/Export/Graphics/Texture.cs:587) ChangeImageTarget.RemoveWhiteBorder (UnityEngine.Texture2D texture) (at Assets/ARjs_Unity/Editor/ChangeImageTarget.cs:89) ChangeImageTarget.OnWizardCreate () (at Assets/ARjs_Unity/Editor/ChangeImageTarget.cs:67) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :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 :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.ScriptableWizard.OnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/ScriptableWizard.cs:79) System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :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 :0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0) UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at /Users/bokken/buildslave/unity/build/Editor/Mono/HostView.cs:381) UnityEditor.HostView.Invoke (System.String methodName) (at /Users/bokken/buildslave/unity/build/Editor/Mono/HostView.cs:375) UnityEditor.HostView.OldOnGUI () (at /Users/bokken/buildslave/unity/build/Editor/Mono/HostView.cs:151) 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/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/bokken/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:508) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:491) UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:484) UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:477) UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/IMGUIContainer.cs:449) UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Events/EventHandler.cs:77) UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/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/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:310) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:275) UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:238) UnityEngine.UIElements.EventDispatcher.OpenGate () (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:203) UnityEngine.UIElements.EventDispatcherGate.Dispose () (at /Users/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:44) UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at /Users/bokken/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/bokken/buildslave/unity/build/Modules/UIElements/EventDispatcher.cs:159) UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/Panel.cs:257) UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:404) UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/Modules/UIElements/UIElementsUtility.bindings.cs:194) UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:197)

weldonla commented 3 years ago

Sorry for the late reply. Click on the .png image and make sure the "Texture Type" is "Sprite (2D and UI)" I think this will resolve your issue.

image

tommaster-pixel commented 3 years ago

hi i too got same error even "Texture Type" is "Sprite (2D and UI)" kindly help me it is vvery urgent.

weldonla commented 3 years ago

It is likely a problem with some import setting. Please check this and see if it helps, if it doesn't please post a picture of your import settings

https://unionassets.com/iosnative/texture-is-not-readable-177