protected virtual void Update() { if (strokeFilter == null) { strokeFilter = GetComponent <StrokeFilter>(); if (strokeFilter != null) { strokeFilter.OnStrokeModified += UpdateRenderer; } } }
public void Begin() { _isBrushing = true; _curStroke = new Stroke(); _lastStrokePoint = StrokePointFromCurrentState(); _curStrokeObj = Instantiate <GameObject>(strokeRendererPrefab.gameObject, outputParent); _curStrokeObj.name = "Brush " + this.name + " Stroke " + (++_curStrokeObjIdx); //var curStrokeRenderer = _curStrokeObj.GetComponent<StrokeRendererBase>(); _curStrokeFilter = _curStrokeObj.GetComponent <StrokeFilter>(); if (_curStrokeFilter == null) { _curStrokeFilter = _curStrokeObj.AddComponent <StrokeFilter>(); } _curStrokeFilter.stroke = _curStroke; AddStrokePoint(_lastStrokePoint); }