Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
0
Question by PuneetK · Sep 05, 2013 at 04:49 PM · buggridtilesinteractionduplicate

Wierdest bug ever!! (pls help!)

Ok, so this is regarding a grid based game I'm working on, in which the object translates in the direction inputted by the user until it collides with an object.

Some tiles of the grid don't have objects, but they are interactable, such as bonus point tiles, teleportation tiles, next level load tiles, and tiles that are empty (fall through them).

Now this bug I'm about to tell you about occurs with the "interactable tiles". When I load a scene for the first time, they all work perfectly fine just the way I want them to. If you go to an empty tile, you fall through; if you hit a bonus tile, you get bonus points, etc. Now let's say I build and run my whole project, and load level 1. Assume, level 2 has some or the other "interactable tile". I play through level 1, and as soon as I get to level 2, the interactables start acting buggy. Sometimes they don't work at all, sometimes they work, its very random. And then, when I open level 2 again by manually opening its scene, the interactables WONT work. But if I delete the interactable tiles, and replace them with a new prefab of the same tile type... It works perfectly. Then when I load again via building and playing from a previous level, it stops working again. I can repeat this process a million times and haven't found the solution. Rather, I haven't even understood the problem and WHY I am getting it.

Please help out and let me know if you have any idea as to what might be going wrong. Even if you don't have a solution at least let me have your view as to what the problem might be caused by. Would really appreciate your answers to this really really really unusual bug!

Comment
Add comment · Show 21
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 meat5000 ♦ · Sep 05, 2013 at 04:50 PM 1
Share

Don't use static variables.

avatar image PuneetK · Sep 05, 2013 at 04:57 PM 0
Share

I haven't used static anywhere, except for the index of the current level. That is, static int currentlevel. It starts from 0 and goes all the way upto the last level index.

avatar image meat5000 ♦ · Sep 05, 2013 at 05:24 PM 0
Share

I say static variables because it sounds like persistent data ruining your day.

Either that or you are not instantiating your prefabs correctly. This is why dragging them in to scene appears to work.

Some tiles of the grid don't have objects, but they are interactable

If it's not in the hierarchy its not in the game. You can reference scripts and components of prefabs but you need to instantiate a gameobject for it to do what you want In Game.

avatar image Sajidfarooq · Sep 06, 2013 at 04:39 AM 2
Share

$$anonymous$$y initial hunch was similar to meat5000.

Seeing as that is not the case, you are modifying the variables in your prefab directly. Remeber to only modify the "instance" that you created via "instantiate". Generally, people will unwittingly modify the original prefab, despite instantiating.
In short, if you have a public variable like public gameObject aPrefab;
then you say newObject = Instantiate(aPrefab...)...

Remember to always modify newObject, not aPrefab

avatar image meat5000 ♦ · Sep 07, 2013 at 02:25 PM 1
Share

OTHER THREAD

This is essentially the same question, right? You will probably need to close one of them if so.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

20 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

Related Questions

How can I attach a script to all of the tiles inside of my grid? 2 Answers

Positioning Objects Next to Each Other in Code 0 Answers

Problems creating a grid in Runtime 1 Answer

GUI Bug in compiled game. 0 Answers

Adding object to list add the same object to another list 1 Answer


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