Giter VIP home page Giter VIP logo

fastscriptreload's People

Contributors

d0rkknight avatar davemariner avatar handzlikchris avatar mollstam avatar runninglvlan avatar sampruden 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fastscriptreload's Issues

Unable to compile new("option") format instead of new TMP_Dropdown.OptionData("option")

using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class TmpProIssueTest : MonoBehaviour
{
    // dropDown
    [SerializeField] private TMP_Dropdown sortDropDown;
    
    public void Init()
    {
        UnityEngine.Debug.Log("CHANGE HERE");
        
        sortDropDown.options.Clear();
        sortDropDown.options.AddRange(new List<TMP_Dropdown.OptionData>()
        {
            new TMP_Dropdown.OptionData("latest_order"),
            new TMP_Dropdown.OptionData("old_order"), 
            new TMP_Dropdown.OptionData("order_of_progress"),
            new TMP_Dropdown.OptionData("order_of_low_progress")
        });
    }
}

Inheriting from 'Editor' in runtime script is causing error CS0118: 'Editor' is a namespace but is used like a type

This is down to Editor assembly not being referenced for new hot reloaded assembly

FSR: Error when updating files: 'AddNewFieldsTest.cs', FastScriptReload.Editor.Compilation.HotReloadCompilationException: Compiler failed to produce the assembly. Output: 'C:\Users\Chris\AppData\Local\Temp\72848fbb3b4645e28394c26e99b3c675.SourceCodeCombined.cs(124,52): error CS0118: 'Editor' is a namespace but is used like a type

C:\Users\Chris\AppData\Local\Temp\72848fbb3b4645e28394c26e99b3c675.SourceCodeCombined.cs(126,30): error CS0115: 'AddNewFieldsTestEditor__Patched_.OnInspectorGUI()': no suitable method found to override' ---> System.Exception: Compiler failed to produce the assembly. Output: 'C:\Users\Chris\AppData\Local\Temp\72848fbb3b4645e28394c26e99b3c675.SourceCodeCombined.cs(124,52): error CS0118: 'Editor' is a namespace but is used like a type

C:\Users\Chris\AppData\Local\Temp\72848fbb3b4645e28394c26e99b3c675.SourceCodeCombined.cs(126,30): error CS0115: 'AddNewFieldsTestEditor__Patched_.OnInspectorGUI()': no suitable method found to override'
at FastScriptReload.Editor.Compilation.DotnetExeDynamicCompilation.ExecuteDotnetExeCompilation (System.String dotnetExePath, System.String cscDll, System.String rspFile, System.String outLibraryPath, System.Collections.Generic.List1[System.String]& outputMessages) [0x001fe] in E:\_src-unity\FastScriptReload\Assets\FastScriptReload\Scripts\Editor\Compilation\DotnetExeCompilator.cs:309 at FastScriptReload.Editor.Compilation.DotnetExeDynamicCompilation.Compile (System.Collections.Generic.List1[T] filePathsWithSourceCode, ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher unityMainThreadDispatcher) [0x00145] in E:_src-unity\FastScriptReload\Assets\FastScriptReload\Scripts\Editor\Compilation\DotnetExeCompilator.cs:107
--- End of inner exception stack trace ---
at FastScriptReload.Editor.Compilation.DotnetExeDynamicCompilation.Compile (System.Collections.Generic.List1[T] filePathsWithSourceCode, ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher unityMainThreadDispatcher) [0x001e7] in E:\_src-unity\FastScriptReload\Assets\FastScriptReload\Scripts\Editor\Compilation\DotnetExeCompilator.cs:150 at FastScriptReload.Editor.Compilation.DynamicAssemblyCompiler.Compile (System.Collections.Generic.List1[T] filePathsWithSourceCode, ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher unityMainThreadDispatcher) [0x0000e] in E:_src-unity\FastScriptReload\Assets\FastScriptReload\Scripts\Editor\Compilation\DynamicAssemblyCompiler.cs:23
at FastScriptReload.Editor.FastScriptReloadManager+<>c__DisplayClass54_1.b__1 () [0x00063] in E:_src-unity\FastScriptReload\Assets\FastScriptReload\Scripts\Editor\FastScriptReloadManager.cs:380
UnityEngine.Logger:Log (UnityEngine.LogType,object)
ImmersiveVrToolsCommon.Runtime.Logging.LoggerScoped:LogInternal (UnityEngine.LogType,object) (at Assets/FastScriptReload/Plugins/ImmersiveVrToolsCommon/Runtime/Logging/LoggerScoped.cs:52)
ImmersiveVrToolsCommon.Runtime.Logging.LoggerScoped:LogError (object) (at Assets/FastScriptReload/Plugins/ImmersiveVrToolsCommon/Runtime/Logging/LoggerScoped.cs:57)
FastScriptReload.Editor.FastScriptReloadManager/<>c__DisplayClass54_1:b__1 () (at Assets/FastScriptReload/Scripts/Editor/FastScriptReloadManager.cs:425)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()

Install as a UPM package?

I want to try this out, but the plugin doesn't conform to UPM format. Could you please make changes so that we can easily install it as a UPM package?

And since the license is MIT, we can also register the package on OpenUPM for better accessibility.

Improved Debugger support - do not require to recreate breakpoints

Currently new file will be created for hot-reloaded code and breakpoints can be added there.

Alternatively in IDE wide function-breakpoint can be set referencing patched class name ChangedClass*_Patched*

This works but is rather bad user experience.

[ ] Investigate if existing Rider / VS integration packages can be patched by Harmony in a way that'd help improve workflow
[ ] IDE plugin that allows to move existing breakpoints (big issue here is need to install additional IDE plugin)
[ ] other approach? potentially if breakpoints can be read from Unity side maybe adding Debugger.Break in those lines would help?)

License?

A license for an open-source repository is essential to establish clear terms for use and distribution, protect the creator's rights and interests, and build a community of collaborators and contributors.

I would rather avoid getting in trouble if I accidentally left it in an open-source project of mine, so please specify a license. D:

Private nullable fields added at runtime cause errors (only for reference type)

Having an issue Added private nullable field and got error during compilation CS8639: The typeof operator cannot be used on a nullable reference type' Related generated line: private static Dictionary<string, System.Func> __Patched_NewFieldsToGetTypeFnDictionaryFieldName = new() {["kitchenObject"] = () => typeof(KitchenObject? ), }; (edited)

Support User defined conversion

[Serializable]
    public class SharedHasHealthBase__Patched_: SharedVariable<HasHealthBase> {
        public static implicit operator SharedHasHealthBase(HasHealthBase value) { *//CH: that should be rewritten as SharedHasHealthBase__Patched_*
            return new SharedHasHealthBase { Value = value };
        }
    }

[ ] Duke from Discord

Visual Studio Code: Omnisharp can't resolve primary reference "0Harmony"

I'm using Visual Studio Code and Omnisharp complains that it cannot resolve "0Harmony" because it was built against a different framework version (v4.8) than the currently targeted one (v4.7.1):

[info]: OmniSharp.MSBuild.ProjectManager
        Successfully loaded project file 'c:\dev\unity\Simulator\FastScriptReload.Runtime.csproj'.
c:\dev\unity\Simulator\FastScriptReload.Runtime.csproj
C:\Program Files\dotnet\sdk\7.0.103\Microsoft.Common.CurrentVersion.targets(2352,5): Error: The primary reference "0Harmony" could not be resolved because it was built against the ".NETFramework,Version=v4.8" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.7.1".

Some more info:

  • FastScriptReload 1.4-rc1
  • Unity 2022.2.10
  • Visual Studio Code
    Version: 1.77.0 (system setup)
    Commit: 7f329fe6c66b0f86ae1574c2911b681ad5a45d63
    Date: 2023-03-29T10:02:16.981Z
    Electron: 19.1.11
    Chromium: 102.0.5005.196
    Node.js: 16.14.2
    V8: 10.2.154.26-electron.0
    OS: Windows_NT x64 10.0.19045
    Sandboxed: Yes
  • Visual Studio Code C# Extension
    Id: ms-dotnettools.csharp
    Description: C# for Visual Studio Code (powered by OmniSharp).
    Version: 1.25.4
    Publisher: Microsoft
    VS Marketplace Link: https://marketplace.visualstudio.com/items?itemName=ms-dotnettools.csharp

Is there any way to resolve this issue?

Could Attributes be supported ?

What are the current limitations around Attributes ?

I'm very often adding / removing attributes at editor / runtime in order to debug or more clearly see my data structures (with odin inspector for instance).

I also use them for dependency injection.

Is it doable, easy or hard ?

Support partial classes

Partial classes need to be correctly rewritten.

Possibly best approach is to pull all partial classes files into single and compile.

[ ] reach back to tommox86 from forum thread

FSR Compilation error

Hello. We are developing with Unity 2022(Intel Version) on Mac OS (Silicon)
I'm getting the error below:
Is there any solution?


FSR: Compilation error: temporary files were not removed so they can be inspected:
UnityEngine.Logger:Log (UnityEngine.LogType,object)
ImmersiveVrToolsCommon.Runtime.Logging.LoggerScoped:LogInternal (UnityEngine.LogType,object)
ImmersiveVrToolsCommon.Runtime.Logging.LoggerScoped:LogError (object)
FastScriptReload.Editor.Compilation.DotnetExeDynamicCompilation:Compile (System.Collections.Generic.List1<string>,ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher) (at Assets/FastScriptReload/Scripts/Editor/Compilation/DotnetExeCompilator.cs:105) FastScriptReload.Editor.Compilation.DynamicAssemblyCompiler:Compile (System.Collections.Generic.List1,ImmersiveVRTools.Runtime.Common.UnityMainThreadDispatcher) (at Assets/FastScriptReload/Scripts/Editor/Compilation/DynamicAssemblyCompiler.cs:23)
FastScriptReload.Editor.FastScriptReloadManager/<>c__DisplayClass45_1:b__2 () (at Assets/FastScriptReload/Scripts/Editor/FastScriptReloadManager.cs:367)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()


FSR: Error when updating files: 'ABCDE.cs', System.InvalidCastException: Specified cast is not valid.
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitIncompleteMember (Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax node) [0x00026] in <7fb80e7e71474ba9a2b7085379c47dd6>:0
at Microsoft.CodeAnalysis.CSharp.Syntax.IncompleteMemberSyntax.Accept[TResult] (Microsoft.CodeAnalysis.CSharp.CSharpSyntaxVisitor1[TResult] visitor) [0x00000] in <7fb80e7e71474ba9a2b7085379c47dd6>:0 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit (Microsoft.CodeAnalysis.SyntaxNode node) [0x0001c] in <7fb80e7e71474ba9a2b7085379c47dd6>:0 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode] (TNode node) [0x00000] in <7fb80e7e71474ba9a2b7085379c47dd6>:0 at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode] (Microsoft.CodeAnalysis.SyntaxList1[TNode] list) [0x00017] in <7fb80e7e71474ba9a2b7085379c47dd6>:0
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitClassDeclaration (Microsoft.CodeAnalysis.CSharp.Syntax.ClassDeclarationSyntax node) [0x0007d] in <7fb80e7e71474ba9a2b7085379c47dd6>:0

'This' rewriting causes some issues with rewritting generic methods

KillerJoe โ€” Yesterday at 20:02
next problem: I have a generic Method "Parent" for the UiElements:

public static T Parent(this T element, VisualElement parent, bool grow = false, int? insertIndex = null) where T : VisualElement {

its changed to ".Parent((dynamic)this)" causing an compile error.

FSR: Error when updating files: 'LoadByUrl.cs', System.Exception: Compiler failed to produce the assembly. Output: 'C:\Users\tfoso\AppData\Local\Temp\3bcdba1c62ed4b1d9e72f62953347396.SourceCodeCombined.cs(222,15): error CS1929: 'HorizontalPanel' does not contain a definition for 'Parent' and the best extension method overload 'VisualElementExtension.Parent(T, VisualElement, bool, int?)' requires a receiver of type 'T'

C:\Users\tfoso\AppData\Local\Temp\3bcdba1c62ed4b1d9e72f62953347396.SourceCodeCombined.cs(259,87): error CS1929: 'I18nLabel' does not contain a definition for 'Parent' and the best extension method overload 'VisualElementExtension.Parent(T, VisualElement, bool, int?)' requires a receiver of type 'T'

[ ] Killer Joe from Discord

Reinitializing file-watchers as defined configuration spams every frame

Commented out for 1.4

File watchers should reintialize if statics were reloaded by Unity for some reason

With a warning to let user know what happened.

  • Sometimes Unity seems to be odd and resets statics (quietly) eg on 2020 when you open a project file (say the one created for debugging) - it'll do that

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.