Skip to content

New Private field method access issue [Workaround] #121

Open
@builder-main

Description

@builder-main

Current Workaround

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

_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<Indus.Client.Cameras.CinemachineBodyCollider__Patched_>(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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions