Skip to content
This repository was archived by the owner on Jul 11, 2023. It is now read-only.

Commit b885314

Browse files
committed
canvas支持camera模式
1 parent 509e012 commit b885314

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Assets/TextInlineSprite/Scripts/InlineManager.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,17 @@ public void UpdateTextInfo(int _id,InlineText _key, List<SpriteTagInfo> _value)
7575
int _spriteTagCount = _value.Count;
7676
Vector3 _textPos = _key.transform.position;
7777
Vector3 _spritePos = _IndexSpriteGraphic[_id]._SpriteGraphic.transform.position;
78-
Vector3 _disPos = (_textPos - _spritePos)*(1.0f/ _key.pixelsPerUnit);
78+
Vector3 _disPos = (_textPos - _spritePos)*(1.0f/ _key.pixelsPerUnit);
79+
//新增摄像机模式的位置判断
80+
if (_key.canvas != null)
81+
{
82+
if (_key.canvas.renderMode == RenderMode.ScreenSpaceCamera)
83+
{
84+
_disPos = _disPos / _key.canvas.transform.localScale.x;
85+
}
86+
}
7987

80-
MeshInfo _meshInfo = new MeshInfo();
88+
MeshInfo _meshInfo = new MeshInfo();
8189
_meshInfo._Tag = new string[_spriteTagCount];
8290
_meshInfo._Vertices = new Vector3[_spriteTagCount * 4];
8391
_meshInfo._UV = new Vector2[_spriteTagCount * 4];

0 commit comments

Comments
 (0)