Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Thursday, June 8, for a Q&A with Unity's Content Pipeline group here on the forum, and on the Unity Discord, and discuss topics around Content Build, Import Workflows, Asset Database, and Addressables!
    Dismiss Notice

SRDebugger - On-Device Console, Options Panel, and Bug Reporter.

Discussion in 'Assets and Asset Store' started by Simie, Feb 7, 2015.

  1. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    Just to confirm - the value is updating correctly when tapping and entering a new number via text, or hitting the arrows, but not when dragging?

    I have attached an updated OptionDefinition.cs that has an additional parameter to pass in custom attributes, e.g.

    _options.Add(OptionDefinition.Create("some_control",
    () => something(),
    (newValue) => something.else = newValue,
    Category, attributes: new Attribute[] { new NumberRangeAttribute(0, 100) }
    ));
     

    Attached Files:

  2. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    171

    Sorry for the super late reply to this, but it looks to be occurring on both device and in editor.
     
  3. BlueSpirit

    BlueSpirit

    Joined:
    Jun 10, 2013
    Posts:
    32
    Hello, I'm getting this error on Android when the target API is set to 33. Is this a SR Debugger issue?

    Code (CSharp):
    1. Error: JNI:GetDeviceName:java.lang.SecurityException: Settings key: <bluetooth_name> is only readable to apps with targetSdkVersion lower than or equal to: 31
    2.  
    3. SRDebugger.Services.Implementation.StandardSystemInformationService:CreateDefaultSet()
    4. System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
    5. SRF.Service.SRServiceManager:AutoCreateService(Type)
    6. SRF.Service.SRServiceManager:GetService()
    7. SRDebugger.Services.Implementation.SRDebugService:.ctor()
    8. System.Reflection.RuntimeConstructorInfo:InternalInvoke(Object, Object[], Boolean)
    9. SRF.Service.SRServiceManager:AutoCreateService(Type)
    10. SRF.Service.SRServiceManager:GetService()
     
    Revolter likes this.
  4. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    This looks like a Unity bug to me. The system info panel is accessing device information via Unity APIs, e.g.:

    InfoEntry.Create("Device Type", UnityEngine.SystemInfo.deviceType),

    So if calling those causes an exception, it's almost certainly a Unity issue.

    You could try commenting out line 90:
    InfoEntry.Create("Device Name", UnityEngine.SystemInfo.deviceName, true),

    As that seems to be the one it's complaining about.
     
  5. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    87
    Hi. Loving the asset. Installed it in to my (nearly) complete ragtag game and it worked straight away. However the demo doesn't appear to work, the tap button never responds. This is using the demo scene in 2022.2.5f1.

    Thought you'd want to know.
     
    Simie likes this.
  6. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    87
    Hi
    Can someone help me with a bit of code for the Options script. I want to have tick boxes for my inventory items, so that I can easily enable them within the game.

    My inventory is a Dictionary so I can easily query that to find out which objects are present in the dictionary, and their values.

    However because the Options file declares the tick boxes as public bools, I'm stumped as to how to create new tick boxes based on something like a FOR loop.

    I want to do something like

    Code (CSharp):
    1. FOR (STUFF HERE)
    2. {
    3.     Instantiate(tickbox("Item #" + i);
    4. }
    You get my drift. Is there a way to do that that is compatible with the Options script requirements?

    Edit:
    I could do something like the following to set each bool, but it require me to create the Bools to match the inventory items, and I'm keen to have them dynamically created.

    Code (CSharp):
    1. public bool myInventoryItem{
    2.  get { return getInventory(); }
    3.  set { setInventoryItem(value); }
    4. }
    5. bool getInventory()
    6. {
    7.      for loop here
    8.     {
    9.         return myDictionary.isValueTrue()
    10.     }
    11. }
    I'm on my phone so can't get the perfect syntax but might give you an idea
     
    Last edited: Mar 12, 2023
  7. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    Thanks for the heads up!

    You can create options dynamically via the API:
    https://www.stompyrobot.uk/tools/srdebugger/documentation/#available-methods

    // Add a dynamic option to the options panel.
    void AddOption(OptionDefinition option);
     
    oliver_unity892 likes this.
  8. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    87
    Perfect. Thanks again. Great asset, which I had it at the start.

    Post here if you ever set up a Discord. Would be a great collaboration place for co-support.
     
  9. oliver_unity892

    oliver_unity892

    Joined:
    Oct 28, 2019
    Posts:
    87
    Is there a way to specify what type of option is created? At the moment it only creates buttons but I'm after tick boxes ideally as it would both allow the user to set a value and also show the value.

    I'm currently using this but it shows as a button. I'd like to set it to be a bool (tick box). I also can't find a way to change the value of an option from within the game when an external function changes the value of the underlying item (in my case whether an inventory item is present in the inventory or not).

    Code (CSharp):
    1.  
    2.                 OptionDefinition newOption= OptionDefinition.FromMethod(item.Key.ToString(), () =>
    3.                 {
    4.                         My code goes here
    5.                 });
    6.                 SRDebug.Instance.AddOption(newOption);
    7.  
    8.  
     
    Last edited: Mar 18, 2023
  10. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    Yup sure, you can create an OptionDefinition with a getter and setter.
    Code (CSharp):
    1.  
    2. bool myBool = false;
    3. var option = OptionDefinition.Create("MyBool", () => myBool, b => myBool = b);
    4. SRDebug.Instance.AddOption(option);
    5.  
    6. // If myBool changes in some other way, call this to notify SRDebugger that the property has changed
    7. option.Property.NotifyValueChanged();
    8.  
     
  11. Davon_Allen_AofL

    Davon_Allen_AofL

    Joined:
    Jul 17, 2019
    Posts:
    9
    is there an established way to add the debug camera option to work on a URP camera stack?
     
  12. Romeno

    Romeno

    Joined:
    Jun 24, 2013
    Posts:
    32
    Hello, I'm figuring out how to change the size (width) of the SR_Sidebar. It is too big on the device and free space can be used by the Options tab contents.

    Any help? Thanks
     
  13. kjorrt

    kjorrt

    Joined:
    Nov 26, 2014
    Posts:
    12
    Hi, when I enable SR Debugger I cannot use my UI elements anymore. None of my buttons work. Is there a setting that I have to alter to get my UI and the SR Debugger working at the same time?
     
  14. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    171
    Hello, just wanted to say great work on the asset once again!

    So I was trying to remove SRDebugger from my release builds using
    SRDebugEditor.SetEnabled(false);
    but I was struggling with finding the right place to put it to work with Unity Cloud Build.

    My initial thought was to put in in OnPreprocessBuild but that doesn't seem to work effectively. Currently, this is because The editor is marked as compiling during this phase and
    SetEnabled(false)
    ensures that this can't be true. I'm assuming because likely there would be issues if Unity was compiling and SRDebugger removed its files at the same time.

    So in short I was just curious if there were some best practices here, or a common approach for doing what I'm after.

    Thanks for any help in advance!
     
  15. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    212
    Hey @Simie,

    I have two issues, one minor, and one more or less critical:
    • Minor: Editor categories not sorted by name like the ugui ones
    • Critical: It's getting progressively slower to add/remove containers (dynamically) the more options you have, now it can take up to 10 seconds on device, and it only happens with the ugui one, not the inspector. (maybe waiting one frame before updating all changes could solve this)
     
    Last edited: Apr 21, 2023
  16. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    The new I(Pre|Post)processBuildWithReport interfaces seems to work for me:

    public class BuildPipelineIntegration : IPreprocessBuildWithReport, IPostprocessBuildWithReport
    {
    public int callbackOrder => 0;

    public void OnPreprocessBuild(BuildReport report)
    {
    if ((report.summary.options & BuildOptions.Development) == 0) // Disable SRDebugger in non-development builds
    {
    SRDebugEditor.SetEnabled(false);
    }
    }

    public void OnPostprocessBuild(BuildReport report)
    {
    SRDebugEditor.SetEnabled(true);
    }
    }


    Let me know if that helps!
     
  17. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    SRDebugger creates its own event system if it doesn't detect one. You can disable this in the settings: upload_2023-4-23_12-54-1.png

    Can you give that a try and see if it helps?
     
  18. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    What device is this happening on? It's only supposed to appear on devices with large enough landscape orientation for the sidebar to fit.
     
  19. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    I'll have these fixed in the next update - I'll PM you the updated files in the mean time.
     
    Revolter likes this.
  20. Meatloaf4

    Meatloaf4

    Joined:
    Jul 30, 2013
    Posts:
    171
    Unfortunately, this doesn't seem to work for me because EditorApplication.isCompiling is equal to true for me when the SRDebug.Editor.SetEnabled(false) is called in OnPreprocessBuild.
     
  21. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    That is odd, it seems to work fine when performing a local build.

    Perhaps you could run a pre-build script that opens the Unity editor and invokes a custom method that calls SRDebugEditor.SetEnabled(false); ?

    https://docs.unity3d.com/2022.1/Documentation/Manual/UnityCloudBuildAdvancedOptions.html
    > Script hooks-Pre-Export Method Manipulate project files before the project is built. Examples include copying variables from an external file into the project, processing Assets, or working with plug-ins
    that require special treatment
     
  22. nosajtevol

    nosajtevol

    Joined:
    Jun 28, 2012
    Posts:
    218
    Hey guys, any reason why my options would show in the editor but not in the build? Thanks
     
  23. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    Hey,

    Which platform are you building for? Is IL2CPP enabled? Could you check what the "Managed Stripping Level" setting in the player options is set to?
     
  24. mbevin

    mbevin

    Joined:
    Mar 20, 2023
    Posts:
    1
    Hi, I'm reading this close to a year later, having hit the same issue.... I still don't see any such feature? It would be really useful.
     
  25. Simie

    Simie

    Joined:
    Oct 26, 2012
    Posts:
    450
    I posted again about this a later on the same page: https://forum.unity.com/threads/srd...-and-bug-reporter.296403/page-14#post-7947547

    The requested functionality is already available:

     
  26. Revolter

    Revolter

    Joined:
    Mar 15, 2014
    Posts:
    212
    @Simie, could you please add support for long to NumberControl.ValueRanges?
    I did it manually, but would be nice to also have that in next version if I update.
    Thanks!