handzlikchris / handzlikchris/FastScriptReload

New Private field method access issue [Workaround]

Aperta
#121 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
workaround
Lingua principale
C#
Stelle
2.2k
Fork
167
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

## Current Workaround

So it seems this is the workaround for now. Any direct access the new field breaks the rewritter.

```c#
_instanceNewField.DoesWhatYouWant(); //<- fails to rewrite
var myLocalNewField = _instanceNewField; // <- this gets correctly rewritten
myLocalNewField.DoesWhatYouWant(); //<- All good
```
Then on your next recompilation round you can clean up the syntax.

## Issue
I'm not sure if it's a regression and what would be its reason, but most of the time nowadays adding private fields fails as they are not rewritten correctly in every places. Example bellow.
Added
`private CameraState _lastCamState;`

One of the correctly rewritten part I believe
`FastScriptReload.Scripts.Runtime.TemporaryNewFieldValues.ResolvePatchedObject(this)._lastCamState = state;`

Some other places not rewritten
` Gizmos.DrawWireSphere(_lastCamState.FinalPosition, BodyRadius);`

It is the NewFieldsRewriter job to perform the rewrite now not sure why it skip some cases.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.