コード例 #1
0
        Mesh GetScatterableMesh()
        {
            if (_mesh == null)
            {
                return(null);
            }

            // Use own mesh if it already exists.
            if (_ownMesh)
            {
                return(_ownMesh);
            }

            if (ScatterTool.CheckScatterable(_mesh))
            {
                // Use the given mesh if it's scatterable.
                return(_mesh);
            }
            else
            {
                // Make scatterable clone and return it.
                _ownMesh           = ScatterTool.MakeScatterableClone(_mesh);
                _ownMesh.hideFlags = HideFlags.DontSave;
                return(_ownMesh);
            }
        }
コード例 #2
0
        void OnPostprocessModel(GameObject go)
        {
            var filename = Path.GetFileNameWithoutExtension(assetPath);

            if (filename.ToLower().EndsWith("scatterable"))
            {
                foreach (var meshFilter in go.GetComponentsInChildren <MeshFilter>())
                {
                    ScatterTool.MakeScatterableInplace(meshFilter.sharedMesh);
                }
            }
        }