question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

startup error on Unity2020.3.29: Type.GetType("UnityEditor.SceneViewOverlay, UnityEditor") .GetMethods(BindingFlags.Public | BindingFlags.Static) .First(x => x.Name == "Window" && x.GetParameters().Length == 5);

See original GitHub issue

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.InvalidOperationException: Sequence contains no matching element at System.Linq.Enumerable.First[TSource] (System.Collections.Generic.IEnumerable1[T] source, System.Func2[T,TResult] predicate) [0x00011] in <351e49e2a5bf4fd6beabb458ce2255f3>:0 at Coffee.UIExtensions.UIParticleEditor.Init () [0x00006] in XXXXXX\Thirdparty\ParticleEffectForUGUI\Scripts\Editor\UIParticleEditor.cs:89 at (wrapper managed-to-native) System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <695d1cc93cca45069c528c15c9fdd749>:0 — End of inner exception stack trace — at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00048] in <695d1cc93cca45069c528c15c9fdd749>:0 at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <695d1cc93cca45069c528c15c9fdd749>:0 at UnityEditor.EditorAssemblies.ProcessInitializeOnLoadMethodAttributes () [0x00047] in <7ebb9dc74040436998557fc331a964ba>:0 UnityEditor.EditorAssemblies:ProcessInitializeOnLoadMethodAttributes ()

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
Ribosome2commented, Jun 23, 2022

image

As you can see ,there is no 5 parameter method but one with 6 var overlayType = Type.GetType(“UnityEditor.SceneViewOverlay, UnityEditor”); var methods = overlayType.GetMethods(BindingFlags.Public | BindingFlags.Static); var miSceneViewOverlayWindow = methods.First(x => x.Name == “Window” && x.GetParameters().Length == 6); var windowFunction = (Action<UnityEngine.Object, SceneView>)WindowFunction; var windowFunctionType = Type.GetType(“UnityEditor.SceneViewOverlay+WindowFunction, UnityEditor”); var windowFunctionDelegate = Delegate.CreateDelegate(windowFunctionType, windowFunction.Method); var windowTitle = new GUIContent(ObjectNames.NicifyVariableName(typeof(UIParticle).Name)); var sceneViewArgs = new object[] { windowTitle, windowFunctionDelegate, 599, null, 2,null }; codes like this will run without error

0reactions
github-actions[bot]commented, Jun 24, 2022

🎉 This issue has been resolved in version 4.0.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - GetType().GetMethods returns no methods when using ...
You should pass BindingFlags.Instance in order to match instance methods: this.GetType().GetMethods(BindingFlags.Instance | BindingFlags.
Read more >
[Reflection] Method selection with an editor script
I want to be able to select a method from a class using an editor script, save/serialize that selection, then call that method...
Read more >
Type.GetMethods Method (System)
Returns all the public methods of the current Type. GetMethods(BindingFlags). When overridden in a derived class, searches for the methods defined for the ......
Read more >
Type.GetMethod Method (System)
An object representing the method that matches the specified generic parameter count, argument types, modifiers, binding constraints and calling convention, if ...
Read more >
Tips: Use Reflection to invoke "hidden" method
The important things to use reflection are "Type object", "member names", and "BindingFlags". First, get a Type object of target class. Type t...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found