当前位置: 首页>>代码示例>>C#>>正文


C# Mesh.GetInstanceID方法代码示例

本文整理汇总了C#中Mesh.GetInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C# Mesh.GetInstanceID方法的具体用法?C# Mesh.GetInstanceID怎么用?C# Mesh.GetInstanceID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mesh的用法示例。


在下文中一共展示了Mesh.GetInstanceID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Start

    void Start()
    {
        sharedMesh = GetComponent<MeshFilter>().sharedMesh;

        if (sharedMesh == null)
        {
            Debug.Log("[RPGMesh] No MeshFilter.sharedMesh object found");
            enabled = false;
            return;
        }

        meshId = sharedMesh.GetInstanceID();

        if (!triangleTrees.ContainsKey(meshId))
        {
            triangleTrees[meshId] = new RPGTriangleTree(GetComponent<MeshCollider>());
        }
    }
开发者ID:Ramzawulf,项目名称:unityassets,代码行数:18,代码来源:RPGMesh.cs

示例2: GetMeshIdent

 string GetMeshIdent( Mesh mesh )
 {
     return mesh.name + "_" + mesh.GetInstanceID();
 }
开发者ID:merveilles,项目名称:WaitingForHorus,代码行数:4,代码来源:OZMLSave.cs

示例3: SaveMesh

    public static string SaveMesh(Mesh mesh, string path)
    {
        if (savedMeshes.ContainsKey(mesh.name))
        {
            if (savedMeshes[mesh.name].GetInstanceID() != mesh.GetInstanceID())
            {
                Debug.LogError("有重名mesh:"+mesh.name);
            }
            return mesh.name;
        }
        if (System.IO.Directory.Exists(path) == false)
        {
            System.IO.Directory.CreateDirectory(path);
        }
        using (System.IO.Stream s = System.IO.File.Open(System.IO.Path.Combine(path, mesh.name + ".mesh.bytes"), System.IO.FileMode.Create))
        {
            byte[] buf = BitHelper.getBytes(mesh.bounds);
            s.Write(buf, 0, 24);
            UInt32 vc = (UInt32)mesh.vertexCount;
            buf = BitConverter.GetBytes(vc);
            s.Write(buf, 0, 4);
            if (mesh.vertices != null && mesh.vertices.Length != 0)
            {
                s.WriteByte(1);//1 vb pos tag
                for (int i = 0; i < vc; i++)
                {
                    s.Write(BitHelper.getBytes(mesh.vertices[i]), 0, 12);
                    if (i == 0)
                    {
                        Debug.Log("pos0:" + mesh.vertices[i]);
                    }
                }
            }
            if (mesh.colors32 != null && mesh.colors32.Length != 0)
            {

                s.WriteByte(2);//2 vb color tag;
                for (int i = 0; i < vc; i++)
                {
                    s.Write(BitHelper.getBytes(mesh.colors32[i]), 0, 4);
                    Debug.Log("color0:" + mesh.colors32[i]);
                    if (i == 0)
                    {
                        Debug.Log("pos0:" + mesh.vertices[i]);
                    }
                }
            }
            if (mesh.normals != null && mesh.normals.Length != 0)
            {
                s.WriteByte(3);//3 vb normal tag;
                for (int i = 0; i < vc; i++)
                {
                    s.Write(BitHelper.getBytes(mesh.normals[i]), 0, 12);
                    if (i == 0)
                    {
                        Debug.Log("normal0:" + mesh.normals[i]);
                    }
                }
            }
            if (mesh.uv != null && mesh.uv.Length != 0)
            {
                s.WriteByte(4);//4 vb uv tag;
                for (int i = 0; i < vc; i++)
                {
                    s.Write(BitHelper.getBytes(mesh.uv[i]), 0, 8);
                    if (i == 0)
                    {
                        Debug.Log("uv0:" + mesh.uv[i]);
                    }
                }
            }
            if (mesh.uv1 != null && mesh.uv1.Length != 0)
            {
                s.WriteByte(5);//5 vb uv1 tag;
                for (int i = 0; i < vc; i++)
                {
                    s.Write(BitHelper.getBytes(mesh.uv1[i]), 0, 8);
                }
            }
            if (mesh.uv2 != null && mesh.uv2.Length != 0)
            {
                s.WriteByte(6);//6 vb uv2 tag;
                for (int i = 0; i < vc; i++)
                {
                    s.Write(BitHelper.getBytes(mesh.uv[i]), 0, 8);
                }
            }
            s.WriteByte(255);//vb end
            int sub = mesh.subMeshCount;
            s.WriteByte((byte)sub);
            {
                Debug.Log("sub:" + sub);
            }
            for (int i = 0; i < sub; i++)
            {
                int tv = (int)mesh.GetTopology(i);//绘制方式
                s.Write(BitConverter.GetBytes(tv), 0, 4);
                var indices = mesh.GetIndices(i);//索引
                UInt16 length = (UInt16)indices.Length;
                s.Write(BitConverter.GetBytes(length), 0, 2);
//.........这里部分代码省略.........
开发者ID:guozanhua,项目名称:easydown,代码行数:101,代码来源:AssetMgr.cs

示例4: GetMeshToAdd

    private SelectedMesh GetMeshToAdd(Mesh mesh, bool isProjectAsset, Object _assoObj = null)
    {
        string meshPath = AssetDatabase.GetAssetPath(mesh);
        Mesh meshAsset = AssetDatabase.LoadAssetAtPath(meshPath, typeof(Mesh)) as Mesh;
        //If null, it can be a built-in Unity mesh
        if(meshAsset == null)
        {
            return new SelectedMesh(mesh, mesh.name, isProjectAsset, _assoObj);
        }
        string meshName = mesh.name;
        if(!AssetDatabase.IsMainAsset(meshAsset))
        {
            Object main = AssetDatabase.LoadMainAssetAtPath(meshPath);
            meshName = main.name + " - " + meshName + "_" + mesh.GetInstanceID().ToString();
        }

        SelectedMesh sm = new SelectedMesh(mesh, meshName, isProjectAsset, _assoObj);
        return sm;
    }
开发者ID:Howard-Day,项目名称:PixelArt,代码行数:19,代码来源:TCP2_SmoothedNormalsUtility.cs

示例5: GetMeshAssetName

    private string GetMeshAssetName(Mesh mesh, Vector4 lightmapTilingOffset)
    {
        string lightmapPostfix = "_" + lightmapTilingOffset.x + "_" + lightmapTilingOffset.y + "_" +
            lightmapTilingOffset.z + "_" + lightmapTilingOffset.w;

        return mesh.name + lightmapPostfix + "_" + mesh.GetInstanceID().ToString("X8");
    }
开发者ID:cbalderrama,项目名称:wire3d,代码行数:7,代码来源:Unity3DExporter.cs


注:本文中的Mesh.GetInstanceID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。