Esempio n. 1
0
    IEnumerator RecordingCo()
    {
        painting.Hide();
        // Show the painting for a single frame, just so it gets drawn to the
        // render texture, then we need to hide it, or it'll clobber the line
        // renderers
        painting.Show();
        yield return(new WaitForEndOfFrame());

        painting.Hide();

        while (true)
        {
            yield return(new WaitForEndOfFrame());

            // Trim the line back down to the smallest it can be
            if (CurrentLine != null && CurrentLine.positionCount >= 2)
            {
                var last = CurrentLine.GetPosition(CurrentLine.positionCount - 1);
                CurrentLine.positionCount = 1;
                CurrentLine.SetPosition(0, last);
            }
        }

        yield break;
    }
        private void OnDisable()
        {
            painter.OnAssignCanvas -= AssignCanvas;
            painter.OnPainting     -= UpdatePaintArea;
            painter.OnScaleCanvas  -= ScaleRelative;
            painter.Hide();

#if UNITY_EDITOR && UNITY_5_6_OR_NEWER
            UnityEditor.SceneManagement.EditorSceneManager.sceneSaving -= SaveCacheWithScene;
#endif
        }