Take Screenshot feature error using Unity package

Hi everyone.
We are using Crowdin tool for our project in Unity and faced an issue while trying to take a screenshot in editor using “Tools->Crowdwin->Take Screenshot → Take a screenshot and send to Crowdwin”. After pressing that button, the following message appears in console: “Can’t add script behaviour TakeScreenshotForCrowdin because it is an editor script. To attach a script it needs to be outside the ‘Editor’ folder.” and then followed by null ref exception, cause “TakeScreenshotForCrowdin” component wasn’t added. Its quite stange since TakeScreenshotForCrowdin is not located in the Editor folder and is a MonoBehaviour script, so it should be added as component without any problems.

Does anyone know how can we fix this?

Hello,

Hmm, we didn’t receive similar complaints these days. Can you provide full output from the Unity console so I can check everything?

Hi, sorry for the late reply. Here is everything we have in console after trying to take screenshot:

  1. Can’t add script behaviour TakeScreenshotForCrowdin because it is an editor script. To attach a script it needs to be outside the ‘Editor’ folder.
    UnityEngine.GameObject:.ctor (string,System.Type[])
    Crowdin.Editor.SendToServer.SendScreenshotsToServerPopup:TakeScreenshot () (at Library/PackageCache/com.crowdin.unity-plugin@0.2.7/Editor/SendToServer/SendScreenshotsToServerPopup.cs:60)
    Crowdin.Editor.SendToServer.SendScreenshotsToServerPopup:OnGUI () (at Library/PackageCache/com.crowdin.unity-plugin@0.2.7/Editor/SendToServer/SendScreenshotsToServerPopup.cs:41)
    UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)

  2. NullReferenceException: Object reference not set to an instance of an object
    Crowdin.Editor.SendToServer.SendScreenshotsToServerPopup.TakeScreenshot () (at Library/PackageCache/com.crowdin.unity-plugin@0.2.7/Editor/SendToServer/SendScreenshotsToServerPopup.cs:62)
    Crowdin.Editor.SendToServer.SendScreenshotsToServerPopup.OnGUI () (at Library/PackageCache/com.crowdin.unity-plugin@0.2.7/Editor/SendToServer/SendScreenshotsToServerPopup.cs:41)
    UnityEditor.HostView.OldOnGUI () (at <2cd7ebc9c2ef4276a8edbc7de85c89ce>:0)
    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 <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcher.OpenGate () (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcherGate.Dispose () (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <4c8a9874288b4fb78fa7fdbcd8065b00>:0)
    UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <00a477ed1abf4030be646c3244bd3667>:0)

1 Like

Thanks, will check from my side.