Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
4 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
3
Question by Adamnation · May 10 at 10:34 PM · gameobjecteditorbuildbugtilemap

Rule Tile "GameObject" duplicating in build version

Hi all!

We're currently developing a Rogue-like 2.5 Doom-like game and we ran into some issues with the GameObject associated with Rule Tile.

We currently use the Rule Tile feature mixed with Tilemap to be able to easily draw new rooms that will be randomly placed in a dungeon-like pattern (think something like Binding of Isaac) whenever the player start said dungeon. This allows us to have all of our terrain objects and enemies in a Tile Palette, and easily draw whatever we want the player to experience as a challenge. This works great, as long as the game is running in the Editor.

When the game is Build, the GameObject are duplicated and all placed at the same (0,0,0) coordinate of the room. I've done some testing, and it seems to only happen for rooms that aren't already placed in the scene, which in our case is basically all the rooms (we instantiate the layout of the dungeon when the scene is loaded).

Here's some screenshots to get a better idea.

Here you can see 4 explosive barrels in the editor version of the room alt text

Here you can see the same 4 barrels plus 4 duplicated ones that are stack on top of each other as they all tried to spawn at the same place in the build version of the room alt text

Has anyone ever encountered something like this, or used the Rule Tile like that? I've done some testing, but I'm not sure where to go from here to solve this.

Thanks!

bug-editor.png (139.4 kB)
bug-build.png (154.0 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image rh_galaxy · May 10 at 11:41 PM 1
Share

Do you have the rooms as Prefabs? Then instantiate that prefab and put it in place in the world? Any DontDestroyOnLoad objects, they might cause the creation of duplicate?

If you can, I suggest that you debug with brake points when the barrels Instantiate, or in Awake(). Make a Debug.Log() if you are on a mobile device.

But it could be anything else, since it doesn't happen editor. Do you have other objects you Instantiate that also show this?

avatar image Adamnation · May 11 at 12:02 AM 0
Share

The rooms are prefabs variants, all a variation of the same template room. No DontDestroyOnLoad except for Game/Music Manager and Player. This behaviour only happens for GameObject that are placed via the Rule Tile.

For the debugging, I'm not sure where I'd need to place the Debug.Log() since the actual instantiation of the GameObject Rule Tile is not done by any of my scripts. I've tried to pin point where this is happening in the Tiles code, but it didn't make complete sense to me. Also, side note, but how would one go about having debugging logs for a build game? Is there a specific place where the Debug.Log() are being recorded or do I need to set that myself?

avatar image rh_galaxy Adamnation · May 11 at 01:19 AM 1
Share

On Windows it's simple, it's placed here Application.persistentDataPath + "/Player.log"

On Android this may work https://answers.unity.com/questions/1368808/how-to-see-debuglog-when-using-android.html

I have no further ides.

3 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by TavroxGames · May 16 at 11:07 PM

@Adamnation We have the same problem! We've been working on this bug for a few days now, very infuriating.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Adamnation · May 17 at 04:29 PM 0
Share

It is indeed very frustrating. We've tried to used the Tile Palette with GameObject instead of RuleTiles, but that removes all the nice features that allowed us to create rooms quickly. I really hope someone has a solution for this.

avatar image Erzats · May 17 at 04:53 PM 1
Share

Since it seems like we are not going to get an answer, may I ask what have you guys tested so far to debug the issue?

We looked into the openly available rule tile scripts and nothing has led us to believe that the issue is coming from those scripts. We think that the issue might come from the instantiation of a 3D asset in the game world where it starts by instantiating the rule tile itself which is refering to a 3D asset and then it instantiates the 3D asset it references in its rule. That being said, we still can't find where the instantiation of these objects is located.

Although I don't like the next "solution", a greedy bandage-solution would be to have a method which get an array of everything at the position 0,0,0 of the scene via an overlap sphere or something and delete everything there except what is supposed to be at that position.

avatar image Adamnation · May 26 at 01:39 AM 0
Share

@TavroxGames I did find a work around that works for me. Basically, I place all the rooms that can be placed at random in my scene at a position out of the play area and a scale of 0. Once the scene starts, I randomly select my rooms, change their scale back to 1 and place them at the position of my previously calculated layout. Since I'm not instantiating the room, but instead moving it, I don't run into the duplicate gameObject issue. Let me know if this helps you out.

avatar image
1

Answer by Erzats · May 16 at 04:34 PM

I would also be interested in an aswer, if anyone has one to share. I have the same issue.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by theboxfriend · May 26 at 01:20 AM

I encountered the same issue and reported it as a bug to Unity. They were able to reproduce it and have added it to the issue tracker

A pretty hacky workaround that I've been using is checking the local position of the object, if it is at 0,0 it will destroy itself on Awake

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Adamnation · May 26 at 01:36 AM 1
Share

This is exactly the behaviour I've been seeing.

I did find a work around that works for me tho. Basically, I place all the rooms that can be placed at random in my scene at a position out of the play area and a scale of 0. Once the scene starts, I randomly select my rooms, change their scale back to 1 and place them at the position of my previously calculated layout. Since I'm not instantiating the room, but instead moving it, I don't run into the duplicate gameObject issue. This seems to be working well for me and it even reduced the loading time of my scene. I'm now working on trying to make this even more optimal, got a couple of ideas I want to try out.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

270 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Build does behave different to editor 2 Answers

Objects that appear in the editor's game view do not appear in the game build 0 Answers

Why can't I SetActive children of this canvas on Mac? 1 Answer

Scene changes not being reflected in standalone build 2 Answers

Game works fine in editor, but build fails with 59 error in the console 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges