Select your preferred scripting language. All code snippets will be displayed in this language.
Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.
CloseFor some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.
Closeposition | Position of the Tile on the Tilemap. |
tilemap | The Tilemap the tile is present on. |
go | The GameObject instantiated for the Tile. |
bool Whether the call was successful.
StartUp is called on the first frame of the running scene.
Use this to set values for the instantiated GameObject or run any logic at the beginning of the scene.
no example available in JavaScript
using UnityEngine; using UnityEngine.Tilemaps;
// Tile that instantiates a GameObject on Start and assigns a random rotation to the instanced GameObject [CreateAssetMenu] public class RandomRotationStartupTile : TileBase { public Sprite m_Sprite; public GameObject m_Prefab;
public override void GetTileData(Vector3Int location, ITilemap tilemap, ref TileData tileData) { tileData.sprite = m_Sprite; tileData.gameObject = m_Prefab; }
public override bool StartUp(Vector3Int location, ITilemap tilemap, GameObject go) { if (go != null) { go.transform.rotation = Random.rotation; } return true; } }
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