Git Product home page Git Product logo

johnbaracuda / com.baracuda.runtime-monitoring Goto Github PK

View Code? Open in Web Editor NEW
401.0 401.0 22.0 96.05 MB

Runtime Monitoring is an easy way for you to monitor the value or state of custom C# members during runtime. Just add the 'Monitor' attribute to a field, property, event, method or even class and get its value or state displayed automatically in a customizable and extendable debug UI.

License: MIT License

C# 100.00%

com.baracuda.runtime-monitoring's People

Contributors

cs-altshift avatar haywirephoenix avatar hlibix avatar johnbaracuda avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

com.baracuda.runtime-monitoring's Issues

Add update rate option to settings

SceneHook causes my debug capsules in scene view to draw erratically when it invokes the LateUpdateEvent. Same result when using the TMP UI. Commenting out the event in lateupdate and adding the below fixes the problem.

 private void FixedUpdate()
        {
            LateUpdateEvent?.Invoke(Time.fixedDeltaTime);
        }

Adding an update rate option to the settings will allow people to select what rate works for them. Excellent work with this asset.

Crashes on Unity 2022.3.10f1 on Android

Hello! I've been trying to fix a bug :

A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 52 bytes but expected 64 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts?

And I found that Runtime-Monitoring might be the culprit. (Deleting it from the project resolves the issue)

Happens on :

  • Logs error (see above) on Windows
  • Logs error and crashes on Android (app closes)

Setup :

  • Unity 2022.3.10f1
  • Android, IL2CPP

Here's the full log :

A scripted object (script unknown or not yet loaded) has a different serialization layout when loading. (Read 52 bytes but expected 64 bytes) Did you #ifdef UNITY_EDITOR a section of your serialized properties in any of your scripts? UnityEngine.StackTraceUtility:ExtractStackTrace () (at C:/build/output/unity/unity/Runtime/Export/Scripting/StackTrace.cs:37) UnityEngine.ResourcesAPI:LoadAll (string,System.Type) (at C:/build/output/unity/unity/Runtime/Export/Resources/Resources.bindings.cs:72) UnityEngine.Resources:LoadAll (string,System.Type) (at C:/build/output/unity/unity/Runtime/Export/Resources/Resources.bindings.cs:143) UnityEngine.Resources:LoadAll<Baracuda.Monitoring.Systems.MonitoringSettings> (string) (at C:/build/output/unity/unity/Runtime/Export/Resources/Resources.bindings.cs:155) Baracuda.Monitoring.Systems.MonitoringSettings:get_Singleton () (at ./Packages/com.baracuda.runtime-monitoring/Runtime/Scripts/Core/Systems/MonitoringSettings.cs:510) Baracuda.Monitoring.Monitor:Construct () (at ./Packages/com.baracuda.runtime-monitoring/Runtime/Scripts/Monitor.cs:105) Baracuda.Monitoring.Monitor:.cctor () (at ./Packages/com.baracuda.runtime-monitoring/Runtime/Scripts/Monitor.cs:93)

Error upon importing assets

Same as before but a bit different now!

Assets\Third Party\Baracuda\Assets\Baracuda\Monitoring\Internal\Units\ValueUnit.cs(149,110): error CS1061: 'T' does not contain a definition for 'ConvertUnsafe' and no accessible extension method 'ConvertUnsafe' accepting a first argument of type 'T' could be found (are you missing a using directive or an assembly reference?)

monitored field appears twice in runtime window

using Baracuda.Monitoring;
using Baracuda.Monitoring.API;


[Monitor] [SerializeField] int aggroCounter = 0;
[Monitor] [SerializeField] float decisionScoreForCover = 0;

in Start I have
MonitoringManager.RegisterTarget(this);

this results in the fields appearing twice. Shouldn't they only appear once?
I removed the SerializeField attribute but this didn't change anything.
Any and all help appreciated.

image

ambiguous reference between

Library\PackageCache\[email protected]\Editor\IL2CPPBuildExtensions.cs(70,55): error CS0104: 'AssemblyFlags' is an ambiguous reference between 'UnityEditor.Compilation.AssemblyFlags' and 'System.Reflection.AssemblyFlags'

Error upon importing assets

Got this error message as soon as I imported. Am I missing something?

Assets\Third Party\Baracuda\Assets\Baracuda\Monitoring\Internal\Utilities\MonitoringInternalExtensions.cs(120,13): error CS0246: The type or namespace name 'Span<>' could not be found (are you missing a using directive or an assembly reference?)

exmaple scene broken

Failed to create Physics Mesh from source mesh. One of the triangles is too large. It's recommended to tesselate the large triangles. Source mesh name: Plattform_01

at bool UnityEditor.SceneManagement.EditorSceneManager.ReloadScene(Scene scene)
void UnityEditor.SceneHierarchy.DiscardChangesInSelectedScenes(object userData)
void UnityEditor.GenericMenu.CatchMenu(object userData, string[] options, int selected)

Instantiation of fields being duplicated

Unity 2022.2.1f1
Windows 10, 64bit

Whenever I click play, the fields that are being monitored normally. However, when I stop and play again, it duplicates the label in the game scene.

Few things I noticed..

  • The scene "freezes" a bit after hitting play, and then "DontDestroyOnLoad" is loaded.
  • Changing Play Mode settings to "Reload Domain" it will clear the previous field being monitored and instantiate only one.
  • Altering script in any way will produce same results as enabling "reload domain" play mode option.
    I've attached a video showing everything I've explained.

https://vimeo.com/784086061 (File is over 10mb, can't upload here)

image

If you die in the demo you get this error...

MissingReferenceException: The object of type 'Baracuda.Example.Scripts.GameManager' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object. Parameter name: obj
�UnityEngine.MissingReferenceException: The object of type 'Baracuda.Example.Scripts.GameManager' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object. Parameter name: obj
void UnityEngine.Object+MarshalledUnityObject.TryThrowEditorNullExceptionObject(Object unityObj, string parameterName)
void UnityEngine.Bindings.ThrowHelper.ThrowArgumentNullException(object obj, string parameterName)
bool UnityEngine.MonoBehaviour.IsObjectMonoBehaviour(Object obj)
Coroutine UnityEngine.MonoBehaviour.StartCoroutine(IEnumerator routine)
void Baracuda.Example.Scripts.GameManager.<Start>b__12_0(?)+() => { } (at Assets/Samples/Runtime Monitoring/3.5.4/Example Scene/Scripts/GameManager.cs:59)
void Baracuda.Example.Scripts.PlayerState.Die() (at Assets/Samples/Runtime Monitoring/3.5.4/Example Scene/Scripts/PlayerState.cs:24)
void Baracuda.Example.Scripts.PlayerMovement.LateUpdate() (at Assets/Samples/Runtime Monitoring/3.5.4/Example Scene/Scripts/PlayerMovement.cs:141)
�   at void UnityEngine.DebugLogHandler.Internal_LogException_Injected(Exception, IntPtr)
void UnityEngine.DebugLogHandler.Internal_LogException(Exception ex, Object obj)
void UnityEngine.DebugLogHandler.LogException(Exception exception, Object context)
void Switchboard.UnityLogger.Log(LogLevel logLevel, Exception exception, ReadOnlySpan<char> message)
void Switchboard.LoggerRoot.Log(LogLevel logLevel, Exception exception, ReadOnlySpan<char> message)
void Switchboard.UnityLogHijacker.LogException(Exception exception, Object context)
void UnityEngine.Logger.LogException(Exception exception, Object context)
bool UnityEngine.Debug.CallOverridenDebugHandler(Exception exception, Object obj)

The bug pertains to the deregistration of a monitored object

Script:

public class DrawShowUI
{
[Monitor]
[MPosition(UIPosition.UpperRight)]
[MGroupName("draw_line")]
//[MGroupElement(false)]
[MFontSize(16)]
[MValueProcessor(nameof(SetUIDraw))]
public string m_name;

public bool is_show;

public void OnLoad(string name, bool show)
{
    m_name = name;
    is_show = show;
    Monitor.StartMonitoring(this);
}

public void ClearUI()
{
    Monitor.StopMonitoring(this);
}

 private string SetUIDraw(string name)
{
    return name + ":" + is_show;
}

}

In the above code, the monitored fields within the grouped section are not successfully unmonitored. However, when replacing the grouped fields with non-grouped ones, the unmonitoring process works correctly.

Truncated text in tracked values.

Sometimes text is truncated due to not enough space for whole text to appear in some of the tracked values. It happens in unity 2023 and 6.0, didn't seem to happen before that. I believe reason for that is that something changed in Unity 2023+ with UnityEngine.GUIStyle.CalcSize() method and is no longer giving proper value. To fix that issue all you have to do is add 1 extra pixel in width of calculated size and issue is gone.

I fixed that locally for myself by adding field:
private readonly Vector2 extraTextSize = new Vector2(1, 0);

And then applying it to 4 textDimensions fields inside MonitoringUIFallback e.g.:
var textDimensions = ctx.Style.CalcSize(_content) + extraTextSize;

Issue:
image

After fix:
image

Wont Display Monitoring UI

I've tried opening the example scene and just get errors stopping it from displaying it seems.
Also tried a default scene with just a script that is a monitored Behavior using the Monitor attributes and still doesn't display on play. Also, when in the example scene and pressing the open Monitor Display key in play mode it just gives a null reference exception.

Capture

Uninstall ?

Hi.
How to uninstall this plugin? I've tried to remove the folder Barracuda but shows this message.

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.Graphs.Edge.WakeUp () (at /home/bokken/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Edge.cs:114)
UnityEditor.Graphs.Graph.DoWakeUpEdges (System.Collections.Generic.List`1[T] inEdges, System.Collections.Generic.List`1[T] ok, System.Collections.Generic.List`1[T] error, System.Boolean inEdgesUsedToBeValid) (at /home/bokken/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:387)
UnityEditor.Graphs.Graph.WakeUpEdges (System.Boolean clearSlotEdges) (at /home/bokken/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:286)
UnityEditor.Graphs.Graph.WakeUp (System.Boolean force) (at /home/bokken/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:272)
UnityEditor.Graphs.Graph.WakeUp () (at /home/bokken/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:250)
UnityEditor.Graphs.Graph.OnEnable () (at /home/bokken/buildslave/unity/build/Editor/Graphs/UnityEditor.Graphs/Graph.cs:245)

Creating a Settings file creates an empty "Resources 1" folder

Hey, first, really cool stuff. I use it in every project.

There is a very tiny problem with the Settings creation : it creates a folder named Resources 1.

image

Also, the Settings is not automatically created when missing, resulting in a Null reference exception.

WebGL UI is not updating

In WebGL :

image

In Editor :

image

Current event time elapsed (just a simple float value) does not update, nor does any other value.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.