public static SoftMeshRenderer Create(Vector3 pos, Vector3 up, Vector3 lookAt, Mesh mesh)
        {
            var device = SoftDevice.StaticDevice;

            if (device != null)
            {
                SoftMeshRenderer ret = device.CreateMeshRenderer(pos, up, lookAt, mesh);
                return(ret);
            }
            return(null);
        }
 private void OnDestroy()
 {
     if (m_SoftMeshRenderer != null)
     {
         m_SoftMeshRenderer.Dispose();
         m_SoftMeshRenderer = null;
     }
     if (m_CustomMesh != null)
     {
         GameObject.Destroy(m_CustomMesh);
         m_CustomMesh = null;
     }
 }
        private void Start()
        {
            m_MeshFilter = GetComponent <MeshFilter>();
            CheckMesh();
            var trans = this.transform;

            Mesh mesh = this.editorMesh;

            m_SoftMeshRenderer = SoftMeshRenderer.Create(trans.position, trans.up, trans.forward, mesh);
            UpdatePos();

            CheckTex();
        }
Exemple #4
0
        public SoftMeshRenderer CreateMeshRenderer(Vector3 pos, Vector3 up, Vector3 lookAt, Mesh mesh)
        {
            SoftMeshRenderer ret = new SoftMeshRenderer(pos, up, lookAt, mesh);

            if (RegisterRenderObject(ret) > 0)
            {
                return(ret);
            }
            else
            {
                if (ret != null)
                {
                    ret.Dispose();
                }
            }
            return(null);
        }