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
1
Question by Daphoeno · Apr 06, 2015 at 09:20 AM · c#androideditor

Script works in the editor but not in builds

I have created a script that removes gaps between moving platforms on my 2D sidescroller game by checking for another platform infront of the platform with the script and then aligning itself to this platform.

The script works perfectly as planned in the unity editor and on PC standalone, but when I put the game onto my android phone, there are gaps and it runs as if the script doesn't even exist.

There are also no errors whatsoever on PC or android

Here is my script:

 using UnityEngine;
 using System.Collections;
 
 public class CheckPos : MonoBehaviour {
     
     public Transform _alignTo = null;
     public bool _align = false;
 
     Transform myTransform;
 
     void Start ()
     {
         myTransform = transform;
     }
 
     void Update()
     {
         myTransform.position = transform.parent.position;
     }
 
     void OnTriggerEnter(Collider other)
     {
         if(other.tag == "Environment" && _align == true){
             _alignTo = other.transform;
             Align();
         } 
     }
 
     void OnTriggerExit ()
     {
         _alignTo = null;
     }
 
     public void Align()
     {
         //yield return new WaitForSeconds(0.1f);
         myTransform.parent.position = _alignTo.transform.position + new Vector3(1f, 0f, 0f);
     }
 }



UPDATE:

I have built a standalone PC version of the game with better debugging. It seems I have the same problem as with android on pc standalone as well.

Unfortunately the errors are fairly vague so I can't pinpoint the problem... any ideas?

alt text

untitled.png (124.3 kB)
Comment
Add comment · Show 5
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 saud_ahmed020 · Apr 06, 2015 at 10:36 AM 0
Share

How you can say, this script is causing problem?? Debug your game while running on android. Hope for the best

avatar image Daphoeno · Apr 06, 2015 at 11:34 AM 0
Share

I have done debugging on android. there are no errors or anything returned, it is just as if he script isn't there in the android version

avatar image Xarbrough · Apr 06, 2015 at 11:46 AM 0
Share

Nothing wrong with your script, so there must be something specific going on elsewhere. Improve on your debugging ;) Just checking if errors are returned isn't the whole thing. To make things simple you can start by adding Debug.Log statements to anything you suspect isn't working, then build with the development build option on. This should at least give you information about which methods are being called. Also test your build settings. .NET 2.0 and stripping disabled, slow and safe script execution if supported.

avatar image DoTA_KAMIKADzE · Apr 06, 2015 at 01:13 PM 0
Share

If it seems like it is not there then maybe it is not there? $$anonymous$$g. read about "magic folders"

avatar image Daphoeno · Apr 06, 2015 at 02:35 PM 0
Share

I have updated the question after trying with better debugging

I now get the error "UnityException: GameObject has undefined tag!"

3 Replies

· Add your reply
  • Sort: 
avatar image
7
Best Answer

Answer by Xarbrough · Apr 06, 2015 at 02:56 PM

GameObject has undefined tag, means that you've previously assigned a tag to an object, you are now querying that tag, but it was deleted from the Tags list in Project Settings > Tags. If it's still there, check the spelling or maybe recreate it to see if that fixes it. All this shouldn't make any difference between platforms.

Comment
Add comment · Show 2 · 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 Daphoeno · Apr 06, 2015 at 03:22 PM 0
Share

Thank you for the response

avatar image Avaruusmuikku · Jun 13, 2015 at 02:21 PM 0
Share

This happened to me when Unity tried to fix a project for some reason. "Fix" removed all my tags and even though they were visible in Inspector view, the tag list itself was empty. Just a heads up in case someone fixes project and experiences the same, really frustrating thing.

avatar image
3

Answer by NullTerminated · Sep 15, 2017 at 08:18 PM

For anyone who had a similar issue:

What happened to me was that I deleted some tags I no longer needed. Then In the editor, the game worked perfectly, but in the build it did not. This is because I ignored the the Unity editor message located right at the bottom of the Tags editor saying something along the lines: if you delete them, you need to restart unity in order for the removed tags to be fully removed.

This will cause errors in your builds if you don't restart unity and fully remove tags.

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
0

Answer by ethestel · Apr 07, 2015 at 09:50 AM

try

 other.gameObject.CompareTag("Environment")

instead of

 other.tag == "Environment"

Hope it helps.

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

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

24 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

Related Questions

Multiple Cars not working 1 Answer

Android APK acts different than in Editor 1 Answer

Distribute terrain in zones 3 Answers

Initialising List array for use in a custom Editor 1 Answer

WaitForSeconds(3) on Android waits less than expected 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