• 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 /
  • Help Room /
avatar image
0
Question by HelpHD · Jul 21, 2016 at 08:46 PM · unity 5editorbuginspectorpublic variable

Inspector assigned variables not assigning in build

So, for the past two hours or so, I was confronting with this weird bug that came out of nowhere.

Without further ado, this is my problem:

Any public variable(that can be assigned in the inspector) isn't showing up/updated in the build but works just fine in the editor. Even if I set the value in code, if the variable is public, it won't show up/be updated. But, if I change the modifier to 'private', it works with no problems.

So, the public variables that existed before the bug, even if I change them(script or inspector, doesn't matter), they hold the value that they had before the bug appeared, and if I try to add new public fields, they just don't show up, here a little example:

 using UnityEngine;
 using System.Collections;
 
 public class TestScript : MonoBehaviour {
 
     public GameObject publicVariable;
 
     void Start ()
     {
         Debug.LogError("publicVariable.name = " + publicVariable.name);
     }
 }

here, I am assigning a gameobject to 'publicVariable' form the inspector. When I run the script in the editor, it works as expected:

 publicVariable.name = GeneratorBoundsLeft
 UnityEngine.Debug:LogError(Object)

However, if I run this on a development build, the Debug.LogError doesn't show up at all.

I hope this was enough information to describe my problem. If code is needed, I will provide.

Any help would be much appreciated.

Comment
Add comment · Show 1
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 HelpHD · Jul 21, 2016 at 09:37 PM 0
Share

So, i've fixed it by exporting the project as package and importing it in a brand new project. Now everything works fine.

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

99 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

Related Questions

Unity 2017 or 5.6 Doesn't work after install. Editor is broken. 0 Answers

Unity 5.0 Crashing At Opening A Project 6 Answers

How do i fix my problem with minimizing/maximizing and just opening unity editor windows? 0 Answers

Unity Has Completely Stopped Working on My Computer 0 Answers

Top Notch Specs, Poor Performance on the Editor 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges