Quantcast
Channel: Questions in topic: "exception"
Viewing all 470 articles
Browse latest View live

How to properly catch Unity Assertion failures?

$
0
0
I have a custom mesh generation function. Depending on the data passed to this function, it might generate an Assertion Failure, which is displayed in the unity console:> Assertion failed: Converting invalid> MinMaxAABB> UnityEngine.Mesh:set_vertices(Vector3[]) The line that generate the assertion failure is: renderedMesh.vertices = tempvertices; Now obviously, this means there is a problem with the tempvertices provided to the mesh. I’m NOT looking for an answer on what conditions might generate such an assertion failure. My question is how do I catch it? (So I can display my OWN message in the unity console.) I have tried putting it in a `try-catch` block, just after setting the `[UnityEngine.Assertions.Assert.raiseExceptions][1]` flag (which appears to exist expressly for this purpose) to true, like so, but it had no effect on the output: UnityEngine.Assertions.Assert.raiseExceptions = true; try { renderedMesh.vertices = tempvertices; } catch (UnityEngine.Assertions.AssertionException e) { Debug.Log("Problem generating mesh for custom object: " + name + " . Aborting mesh generation."); renderedMesh.name = "Problem generating mesh"; return; } [1]: https://docs.unity3d.com/ScriptReference/Assertions.Assert-raiseExceptions.html

Unity 2017.1 stopped throwing exceptions

$
0
0
Yesterday I've updated my project to Unity 2017.1 and switched to .net 4.6. Since then Unity has stopped throwing erorrs when they occur which as you might guess is really frustrating. This happens both in the editor and when the project is built. Does anyone know of any possible reason? There isn't any new configuration about that introduces, is it? Thanks in advance

IronPython will fail on Unity 2017.2.0f3

$
0
0
Hello Everyone. I am running IronPython on Unity. Although it was working on version 2017.1.2f1 or earlier, an error occurs on version 2017.2.0f3. This is Python script. import clr clr.AddReference("UnityEngine") import UnityEngine UnityEngine.Debug.Log("Test message from Python.") This is the error message. ImportException: No module named UnityEngine Microsoft.Scripting.Runtime.LightExceptions.ThrowException (Microsoft.Scripting.Runtime.LightException lightEx) Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow (System.Object value) Microsoft.Scripting.Interpreter.FuncCallInstruction`2[System.Object,System.Object].Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) Microsoft.Scripting.Interpreter.Interpreter.Run (Microsoft.Scripting.Interpreter.InterpretedFrame frame) Your help would be greatly appreciated.

Error in child particle systems (2017 2.0b11)

$
0
0
Hi! When I start the game I get a lot of errors from ParticleSystem. But when I turn off ParticleSystem, there are no mistakes![alt text][1] [1]: /storage/temp/104468-набросок.png

NSInternalInconsistencyException in iOS simulator when building Metal only

$
0
0
Received an ***NSInternalInconsistencyException*** in the iOS Simulator (Xcode v9.1) with Unity 2017.2 using a MacBook Pro (Retina, 15-inch, Late 2013) running High Sierra (10.13.1). The build is set to Metal only. If I build with Metal and OpenGL ES 3, this error will not happen. However, I need to test Metal in the simulator and if I build with both it will select OpenGL ES 3. My video card (NVIDIA GeForce GT 750M) does support Metal and I am able to use the Metal GUI for Unity. I do not see any errors if I build for device (sadly I won't have a device that supports Metal for a few weeks). Uncaught exception: NSInternalInconsistencyException: [UnityAppController renderingAPI] called before [UnityAppController selectRenderingApi] ( 0 CoreFoundation 0x00000001168501ab __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000115eedf41 objc_exception_throw + 48 2 CoreFoundation 0x0000000116855372 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000011281b089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 AfaTest01 0x000000010a20a3a4 -[UnityAppController(Rendering) renderingAPI] + 260 5 AfaTest01 0x000000010a221612 -[UnityAppController application:didFinishLaunchingWithOptions:] + 898 6 UIKit 0x0000000113910c12 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 267 7 UIKit 0x000000011391266f -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4105 8 UIKit 0x0000000113917afd -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720 9 UIKit 0x0000000113cdd2e0 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924 10 UIKit 0x00000001140afbe0 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 11 UIKit 0x0000000113cdced9 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249 12 UIKit 0x0000000113cdd737 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668 13 UIKit 0x0000000114651c4d __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262 14 UIKit 0x0000000114651b06 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444 15 UIKit 0x0000000114332d52 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420 16 UIKit 0x000000011452fa7e _performActionsWithDelayForTransitionContext + 100 17 UIKit 0x0000000114332b4e -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231 18 UIKit 0x00000001140af23d -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 19 UIKit 0x000000011391637e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523 20 UIKit 0x0000000113eeac1b -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369 21 FrontBoardServices 0x0000000119571158 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338 22 FrontBoardServices 0x0000000119579c4d __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235 23 libdispatch.dylib 0x0000000117a802b5 _dispatch_client_callout + 8 24 libdispatch.dylib 0x0000000117a85565 _dispatch_block_invoke_direct + 324 25 FrontBoardServices 0x00000001195a5672 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24 26 FrontBoardServices 0x00000001195a5328 -[FBSSerialQueue _performNext] + 464 27 FrontBoardServices 0x00000001195a5897 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 28 CoreFoundation 0x00000001167f3231 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 29 CoreFoundation 0x0000000116892e41 __CFRunLoopDoSource0 + 81 30 CoreFoundation 0x00000001167d7b49 __CFRunLoopDoSources0 + 185 31 CoreFoundation 0x00000001167d712f __CFRunLoopRun + 1279 32 CoreFoundation 0x00000001167d69b9 CFRunLoopRunSpecific + 409 33 GraphicsServices 0x0000000116eec9c6 GSEventRunModal + 62 34 UIKit 0x00000001139195e8 UIApplicationMain + 159 35 AfaTest01 0x000000010a1facd4 main + 212 36 libdyld.dylib 0x0000000117af4d81 start + 1 37 ??? 0x0000000000000001 0x0 + 1 ) 2017-11-13 17:16:22.677265-0500 AfaTest01[28324:928555] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '[UnityAppController renderingAPI] called before [UnityAppController selectRenderingApi]' *** First throw call stack: ( 0 CoreFoundation 0x00000001168501ab __exceptionPreprocess + 171 1 libobjc.A.dylib 0x0000000115eedf41 objc_exception_throw + 48 2 CoreFoundation 0x0000000116855372 +[NSException raise:format:arguments:] + 98 3 Foundation 0x000000011281b089 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 193 4 AfaTest01 0x000000010a20a3a4 -[UnityAppController(Rendering) renderingAPI] + 260 5 AfaTest01 0x000000010a221612 -[UnityAppController application:didFinishLaunchingWithOptions:] + 898 6 UIKit 0x0000000113910c12 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 267 7 UIKit 0x000000011391266f -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4105 8 UIKit 0x0000000113917afd -[UIApplication _runWithMainScene:transitionContext:completion:] + 1720 9 UIKit 0x0000000113cdd2e0 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 924 10 UIKit 0x00000001140afbe0 +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153 11 UIKit 0x0000000113cdced9 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 249 12 UIKit 0x0000000113cdd737 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 668 13 UIKit 0x0000000114651c4d __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 262 14 UIKit 0x0000000114651b06 -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 444 15 UIKit 0x0000000114332d52 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 420 16 UIKit 0x000000011452fa7e _performActionsWithDelayForTransitionContext + 100 17 UIKit 0x0000000114332b4e -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 231 18 UIKit 0x00000001140af23d -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392 19 UIKit 0x000000011391637e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 523 20 UIKit 0x0000000113eeac1b -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 369 21 FrontBoardServices 0x0000000119571158 -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 338 22 FrontBoardServices 0x0000000119579c4d __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 235 23 libdispatch.dylib 0x0000000117a802b5 _dispatch_client_callout + 8 24 libdispatch.dylib 0x0000000117a85565 _dispatch_block_invoke_direct + 324 25 FrontBoardServices 0x00000001195a5672 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24 26 FrontBoardServices 0x00000001195a5328 -[FBSSerialQueue _performNext] + 464 27 FrontBoardServices 0x00000001195a5897 -[FBSSerialQueue _performNextFromRunLoopSource] + 45 28 CoreFoundation 0x00000001167f3231 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17 29 CoreFoundation 0x0000000116892e41 __CFRunLoopDoSource0 + 81 30 CoreFoundation 0x00000001167d7b49 __CFRunLoopDoSources0 + 185 31 CoreFoundation 0x00000001167d712f __CFRunLoopRun + 1279 32 CoreFoundation 0x00000001167d69b9 CFRunLoopRunSpecific + 409 33 GraphicsServices 0x0000000116eec9c6 GSEventRunModal + 62 34 UIKit 0x00000001139195e8 UIApplicationMain + 159 35 AfaTest01 0x000000010a1facd4 main + 212 36 libdyld.dylib 0x0000000117af4d81 start + 1 37 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException

Stop Unity from freezing on NullReferenceExceptions ?

$
0
0
Hello, I am currently on a advanced state from a software I'm making with Unity. However, because of the complicated hierarchy on my assets, I'm often forced to trigger a NullReferenceException from objects that are activated for a very short of time while they are not exactly loaded. While there is no real affect when I build the software and run it, it slows me down to be forced to stop and relaunch the scrips to get past Unity freezing. So is there any way to make sure Unity overlooks Exceptions and keep running on the editor ? Thank you

when build to webGL

$
0
0
show this message "Assets/Build/UnityLoader.js(1,127): BCE0044: expecting :, found '?'." all for code

How can you easily distinguish between normal messages and error messages in c#?

$
0
0
I just started using android’s LogCat for debugging my Unity app for android. As far as i’ve understood, all Unity-related messages in LogCat can be sorted out by adding a filter with [Log Tag = “Unity”]. My only issue is that i am not sure how to distinguish Error messages from normal print statements in unity, since the LogCat does not make this difference clear. All error messages i’ve seen so far have included the term “Exception”, for example “UnassignedReferenceException”. **It is true that ALL error messages includes this?** If not, is there another simple way to find the error messages in Android’s LogCat?

KeyNotFoundException in animator

$
0
0
Hello everyone. I am trying to animate a sprite while it moves towards the player in Unity 2017.1.1f1.. After editting the sprites, creating the animations and coding I tested the game and it worked perfectly. However, after making a few changes that I had to undo because they weren't working as I wanted them to, I tested again and noticed that the horizontal walking animation wasn't working anymore. When I opened the animator tab there was this message on the console tab: KeyNotFoundException:The given key was not present in the dictionary. UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) Here's a screenshot: ![alt text][1] [1]: /storage/temp/106802-erro-1.png And here's the code, in case it's a programming issue: using System.Collections; using System.Collections.Generic; using UnityEngine; public class EnemyControls : MonoBehaviour { public Transform target; Animator anim; int direction, state; float speed, timer; void Move() { //horizontal movement: move left if (transform.position.x - target.position.x > 0.3f) { direction = 1; state = 1; anim.SetInteger ("direction", direction); anim.SetInteger ("state", state); transform.Translate (-transform.right * speed * Time.deltaTime); } //horizontal movement: move right else if (transform.position.x - target.position.x < -0.3f) { direction = 3; state = 1; anim.SetInteger ("direction", direction); anim.SetInteger ("state", state); transform.Translate (transform.right * speed * Time.deltaTime); } //horizontal movement: stop else { state = 0; anim.SetInteger ("state", state); } //vertical movement: move down if (transform.position.y - target.position.y > 0.3f) { direction = 0; state = 1; anim.SetInteger ("direction", direction); anim.SetInteger ("state", state); transform.Translate (-transform.up * speed * Time.deltaTime); } //vertical movement: move up else if (transform.position.y - target.position.y < -0.3f) { direction = 2; state = 1; anim.SetInteger ("direction", direction); anim.SetInteger ("state", state); transform.Translate (transform.up * speed * Time.deltaTime); } //vertical movement: stop else { state = 0; anim.SetInteger ("state", state); } } // Use this for initialization void Start () { anim = GetComponent (); target = GameObject.FindWithTag ("Player").transform; speed = 1.0f; state = 0; } // Update is called once per frame void Update () { Move (); } } I appreciate any help you can provide.

Try Catch not working with VideoPlayer

$
0
0
I am trying to play a video using Unity's VideoPlayer which I have attached to the camera. I want the user to be able to enter the file path of a local video file and the VideoPlayer should then play the video. I got this working fine but I can't seem to handle exceptions when the user enters a path that is not valid, for instance: try { videoPlayer.url = @"C:\blah"; } catch { print ("error"); } does not print "error" but instead continues execution and gives me an error in the console saying "Can't play movie [C:\blah]" ---------- I can't think of any reason why this error shouldn't be caught by using the try catch method. I am using the latest version of Unity. If you cannot use the try catch method to catch this exception, then I need a way to test if the url is valid and will play properly (e.g. the file is not corrupt)

Cannot set parent for instantiated GameObject. (Exception: Can't destroy Transform component of...)

$
0
0
I have player gameobject that is instantiated in the start of the game. I want to make pickable items to instantiate into the player gameobject's special zones (Marks), such as BowMark or QuiverMark. They are empty objects parented to the player gameobject rigs. The question is when i try to do that items gameobjects don't appear in the scene at all and after stopping editor playmode i have this exception: Can't destroy Transform component of 'weapon_bow_ShenMin02'. If you want to destroy the game object, please call 'Destroy' on the game object instead. Destroying the transform component is not allowed. Here is code sample: GameObject bowMark = GameObject.Find("BowMark"); GameObject in3 = (GameObject)Resources.Load ("Prefabs/FlameBowE"); GameObject in4 = Instantiate(in3, bowMark.transform); After few tests i figure out that problem is in parenting instantiated objects. Could anyone help with this situation please?

Directory Not Found Exception While Generating APK

$
0
0
DirectoryNotFoundException: Could not find a part of the path "Assets\Plugins\Android\appcompat-v7-23.1.1\res\color\abc_background_cache_hint_selector_material_dark.xml" or "Temp\StagingArea\android-libraries\appcompat-v7-23.1.1\res\color\abc_background_cache_hint_selector_material_dark.xml" System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:124) UnityEditor.FileUtil.UnityFileCopy (System.String from, System.String to, Boolean overwrite) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:207) UnityEditor.FileUtil.CopyDirectoryFiltered (System.String source, System.String target, Boolean overwrite, System.Func`2 includeCallback, Boolean recursive) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:142) UnityEditor.FileUtil.CopyDirectoryFiltered (System.String source, System.String target, Boolean overwrite, System.Func`2 includeCallback, Boolean recursive) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:156) UnityEditor.FileUtil.CopyDirectoryFiltered (System.String source, System.String target, Boolean overwrite, System.Func`2 includeCallback, Boolean recursive) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:156) UnityEditor.FileUtil.CopyDirectoryFiltered (System.String source, System.String target, Boolean overwrite, System.String regExExcludeFilter, Boolean recursive) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:121) UnityEditor.FileUtil.CopyDirectoryRecursiveFiltered (System.String source, System.String target, Boolean overwrite, System.String regExExcludeFilter) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:102) UnityEditor.FileUtil.CopyDirectoryRecursiveForPostprocess (System.String source, System.String target, Boolean overwrite) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:97) UnityEditor.Android.PostProcessor.Tasks.NativePlugins.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args) UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186) UnityEditor.HostView:OnGUI()

Unity 2017.3 Android IL2CPP ArgumentNullException

$
0
0
Hello, I'm using too many external libraries in my project to check what causes this error and I can't figure out where this error actually comes from. Please help. :) It works fine with Mono, but with IL2CPP this happens:
01-12 15:44:00.330: E/Unity(13561): ArgumentNullException: Value cannot be null.
01-12 15:44:00.330: E/Unity(13561): Parameter name: method
01-12 15:44:00.330: E/Unity(13561):   at System.Dynamic.Utils.ContractUtils.RequiresNotNull (System.Object value, System.String paramName) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.330: E/Unity(13561):   at System.Linq.Expressions.Expression.Call (System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.330: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T].CreateCustomNoMatchDelegate (System.Reflection.MethodInfo invoke) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.330: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.330: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.330: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.330: E/Unity(13561):   at System.Runtime.CompilerServices.Cal
01-12 15:44:00.340: E/Unity(13561): ArgumentNullException: Value cannot be null.
01-12 15:44:00.340: E/Unity(13561): Parameter name: method
01-12 15:44:00.340: E/Unity(13561):   at System.Dynamic.Utils.ContractUtils.RequiresNotNull (System.Object value, System.String paramName) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.340: E/Unity(13561):   at System.Linq.Expressions.Expression.Call (System.Reflection.MethodInfo method, System.Linq.Expressions.Expression arg0) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.340: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T].CreateCustomNoMatchDelegate (System.Reflection.MethodInfo invoke) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.340: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T].MakeUpdateDelegate () [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.340: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T].GetUpdateDelegate (T& addr) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.340: E/Unity(13561):   at System.Runtime.CompilerServices.CallSite`1[T]..ctor (System.Runtime.CompilerServices.CallSiteBinder binder) [0x00000] in <00000000000000000000000000000000>:0 
01-12 15:44:00.340: E/Unity(13561):   at System.Runtime.CompilerServices.Cal

X.509 certificate exception "~isn't signed" but it really is signed

$
0
0
Hi, everyone! Could you please check this question? [https://stackoverflow.com/questions/48419314/x-509-certificates-exception-aws-iot][1] I'm trying to connect to AWS IoT MQTT broker with X.509 certificates and I get an exception saying CryptographicException. public AWSMqttManager() { //pfx fileName and password var clientCert = new X509Certificate2("C:\\Users\\UNO\\Desktop\\...\\ttc20.pfx", "ttc20"); var caCert = X509Certificate.CreateFromSignedFile("C:\\Users\\UNO\\Desktop\\...\\VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem"); client = new MqttClient(IotEndpoint, BrokerPort, true, caCert, clientCert, MqttSslProtocols.TLSv1_2); client.Connect("TTC-20"); } CryptographicException: C:\Users\UNO\Desktop\...\VeriSign-Class 3-Public-Primary-Certification-Authority-G5.pem isn't signed. System.Security.Cryptography.X509Certificates.X509Certificate.CreateFromSignedFile (System.String filename) (at <9c9f068c46c64ffd91fda7af157b4d15>:0) but the funny thing is the same code exactly works very well in pure c# project. That exception only occurs if I port that part of c# code onto unity project. Also the files (.pfx, .pem) do work for sure because I tested with MQTT.fx. They are fine. Please help me a little bit! Thanks in advance! [1]: https://stackoverflow.com/questions/48419314/x-509-certificates-exception-aws-iot

transform.find exception if child does not exist

$
0
0
Hi there, I need to find some GameObject children by their name. This work perfectly fine if the child I am searching exists. But if it does not exist, I get this exception:> NullReferenceException: Object> reference not set to an instance of an> object According to the Unity docs, I would expect transform.find to return null instead of throwing an exception. Any ideas? GameObject productContainer; // parent Object that contains several (or null) children GameObject item; item = productContainer.transform.Find("product1").gameObject; if (item == null) // this code is never reached - if "product1" does not exist an exception is thrown Debug.Log("Not found"); else Debug.Log("Found"); // this code works if "product1" exists Thanks in advance!

NullReferenceException with serialized array

$
0
0
Hello! I have a script with arrays of serialized objects like this: [Serializable] public class GenerationZones {public GeneratedObjecct [] GeneratedObjets = new GeneratedObjecct[100]; public int PositionX = -1; public int PositionZ = -1; public int State = 0; public int GeneradedObj = 0;} [HideInInspector] public GenerationZones [] GenZones = new GenerationZones[100]; When i hit play in a scene where the script is working everything is ok. But when i hit play in another scene and then i enter a scene with this script, it's not working. On every call to GenZones[n] (or any another same element) the game throws 'NullReferenceException: Object reference not set to an instance of an object'. What can be wrong?

TypeLoadException Error with Unity IAP,TypeLoadException Error when implementing Unity IAP

$
0
0
I am trying to implement Unity IAP into my mobile game. But, as soon as I finished my Purchaser script, I'm getting a TypeLoadException Error: TypeLoadException: Could not load type 'UnityEngine.Purchasing.NativeStoreProvider' from Assembly Stores, Version=1.0.6614.24906, Culture=neutral, PublicKeyToken=null. UnityEngine.Purchasing.StandardPuchasingModule.Instance() My error is in the line --> var builder = ConfigurationBuilder.Instance(...) public void InitializePurchasing() { if (IsInitialized()) { return; } var builder = ConfigurationBuilder.Instance (StandardPurchasingModule.Instance ()); builder.AddProduct(GEMS_100, ProductType.Consumable); builder.AddProduct(GEMS_400, ProductType.Consumable); builder.AddProduct(GEMS_800, ProductType.Consumable); builder.AddProduct(GEMS_1600, ProductType.Consumable); UnityPurchasing.Initialize(this, builder); } private bool IsInitialized() { // Only say we are initialized if both the Purchasing references are set. return m_StoreController != null && m_StoreExtensionProvider != null; } Thanks in advance

Is there any way to handle Exception without outputting as log.

$
0
0
Hi, I'd like to send message to server when exception occurred in release build. My code is below. class RuntimeInitialize { [RuntimeInitializeOnLoadMethod] static void OnRuntimeMethod() { #if DEBUG UnityEngine.Debug.logger.filterLogType = UnityEngine.LogType.Log; #else UnityEngine.Debug.logger.filterLogType = UnityEngine.LogType.Exception; #endif Application.logMessageReceived += OnLogRecieved; } public static void OnLogRecieved(string logString, string stackTrace, LogType type) { if (type != LogType.Exception) return; SendExceptionMessageToServer(logString, stackTrace) } } This code can send Exception message to server, but output message to Logcat simultaneously. How to stop outputting to Logcat ? Thanks.

DirectoryNotFoundException with full existing path... ? I need this AFAP

$
0
0
So, I'm getting this HUGE error, and I don't really know what to do about it... ---------- DirectoryNotFoundException: Could not find a part of the path "C:\Users\multi\Desktop\Project P\Assets\StreamingAssets\Saves\A New Game\game_manager.json". System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:292) System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamWriter.cs:124) System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding) System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:626) System.IO.File.WriteAllText (System.String path, System.String contents) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:621) GameManager+c__Iterator0.MoveNext () (at Assets/GameManager.cs:123) UnityEngine.SetupCoroutine.InvokeMoveNext (IEnumerator enumerator, IntPtr returnValueAddress) (at C:/buildslave/unity/build/Runtime/Export/Coroutines.cs:17) UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator) GameManager:LoadGame() (at Assets/GameManager.cs:89) SavesLoader:m__0() (at Assets/UI/SavesLoader.cs:63) UnityEngine.EventSystems.EventSystem:Update() ---------- Eh... Could someone help me please? The path exists, and there is no reason for it to not save the file... This is how I save my files: string newFile = JsonUtility.ToJson(managerJSON); File.WriteAllText(SaveDirectory + "game_manager.json", newFile); For some reason my "A New Game" folder is read only. does this mess with my system for some reason? Thanks in advance.

How do you make IOS storyboard launch screens work?

$
0
0
I'm just cross-posting here in hopes to find a Unity employee with some answers. This is a new feature but doesn't seem to be documented. Adding a storyboard causes an exception in Unity 2017.3.1p3 when running on my iPhone 6 with IOS 9.3.5 Uncaught exception: NSInvalidArgumentException: Storyboard () doesnt contain a view controller with identifier 'unitySplashStoryboard' More details here: https://forum.unity.com/threads/cant-get-launchscreen-storyboard-to-work-need-docs.524865/
Viewing all 470 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>