타일맵에 추가되는 모든 타일은 TileBase
로부터 값을 상속받습니다. TileBase
는 고정된 API 세트를 타일맵에 제공하여 렌더링 프로퍼티를 전달합니다. 대부분의 API에서는 타일의 위치와 타일이 배치되어 있는 타일맵의 인스턴스가 API의 인수(argument)로 전달됩니다. 타일 정보를 설정하기 위해 필요한 속성을 결정하는 데 사용할 수 있습니다.
public void RefreshTile(Vector3Int location, ITilemap tilemap)
RefreshTile
은 타일이 타일맵에 추가될 때 주위의 어떤 타일이 업데이트될지 결정합니다. 기본적으로 TileBase
는 tilemap.RefreshTile(location)
을 호출하여 현재 위치에 있는 타일을 새로 고칩니다. 이 구문을 오버라이드하여 새 타일을 배치할 때 새로 고쳐져야 하는 타일을 결정할 수 있습니다.
예: 직선 도로 옆에 RoadTile
을 배치합니다. 타일을 기존 직선 도로 옆에 붙이는 순간 도로가 접하는 부분은 T자형 교차로로 수정되어야 합니다. Unity 에디터는 어떤 부분을 새로 고쳐야 하는지 스스로 알지 못하므로 RoadTile
이 자신의 새로 고침을 트리거해야 할 뿐만 아니라 접하는 도로도 새로 고쳐지도록 트리거해야 합니다.
public bool GetTileData(Vector3Int location, ITilemap tilemap, ref TileData tileData)
GetTileData
는 타일맵에 표시되는 타일의 모습을 결정합니다. 자세한 내용은 TileData
를 참조하십시오.
public bool GetTileAnimationData(Vector3Int location, ITilemap tilemap, ref TileAnimationData tileAnimationData)
GetTileAnimationData
는 타일의 애니메이션화 여부를 확인합니다. 타일에 애니메이션이 있으면 True를 반환하고 없으면 False를 반환합니다.
public bool StartUp(Vector3Int location, ITilemap tilemap, GameObject go)
StartUp
은 타일맵이 처음 업데이트될 때 각 타일에 대해 호출됩니다. 필요한 경우 타일맵에서 타일에 대한 시작 로직을 실행할 수 있습니다. go 인수는 GetTileData
가 호출될 때 게임 오프젝트로서 전달된 오브젝트의 인스턴스화된 버전입니다. 필요에 따라 go를 업데이트할 수도 있습니다.
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.