slipster216 / VertexPaint

Unity 5.3 Vertex Painter
Other
906 stars 151 forks source link

Assets/VertexPaint-master/VertexInstanceStream.cs(457,33): error CS0103: The name `meshStream' does not exist in the current context #4

Closed Russel1 closed 8 years ago

Russel1 commented 8 years ago

"private Mesh meshStream;" must be outside of #if UNITY_EDITOR construct for iOS or Android Build:

// hack around unity bugs in the editor.. private Mesh meshStream;

if UNITY_EDITOR

    public Mesh GetModifierMesh() {
        return meshStream;
    }

    void Update() {
        if (!Application.isPlaying) {
            MeshRenderer r = GetComponent<MeshRenderer>();
            r.additionalVertexStreams = meshStream;
        }
    }

endif

slipster216 commented 8 years ago

If you sync this is fixed, but by fixing the incorrect use of meshStream outside of the #if. Saves memory for a pointer at runtime.

Sent from my iPhone

On Feb 12, 2016, at 4:52 AM, Russel1 notifications@github.com wrote:

The meshStream must be outside of #if UNITY_EDITOR construct:

// hack around unity bugs in the editor.. private Mesh meshStream;

if UNITY_EDITOR

public Mesh GetModifierMesh() {
    return meshStream;
}

void Update() {
    if (!Application.isPlaying) {
        MeshRenderer r = GetComponent<MeshRenderer>();
        r.additionalVertexStreams = meshStream;
    }
}

endif

— Reply to this email directly or view it on GitHub.

apautrot commented 8 years ago

By looking at the code on GitHub I would rather say that meshStream is wrongly used on lines

meshStream.UploadMeshData(markNoLongerReadable);
mr.additionalVertexStreams = meshStream;

Profiler.EndSample();

Profiler.EndSample();
return meshStream;

and that stream should be used instead :

stream.UploadMeshData(markNoLongerReadable);
mr.additionalVertexStreams = stream;

Profiler.EndSample();

Profiler.EndSample();
return stream;

Also note that Profiler.EndSample(); appears twice, is that intended ?

slipster216 commented 8 years ago

I must have forgotten to sync after submitting my change list; Yes, all of those should be stream. The second EndSample is correct though; I've added comments to the code to mark which profiler block they are closing so it'll be easier to parse. (And this time I hit sync after submit)

On Mon, Feb 15, 2016 at 4:43 AM, apautrot notifications@github.com wrote:

By looking at the code on GitHub I would rather say that meshStream is wrongly used on lines

meshStream.UploadMeshData(markNoLongerReadable); mr.additionalVertexStreams = meshStream;

Profiler.EndSample();

Profiler.EndSample(); return meshStream;

and should be

stream.UploadMeshData(markNoLongerReadable); mr.additionalVertexStreams = stream;

Profiler.EndSample();

Profiler.EndSample(); return stream;

Also note that Profiler.EndSample(); appears twice, is that intended ?

— Reply to this email directly or view it on GitHub https://github.com/slipster216/VertexPaint/issues/4#issuecomment-184135266 .