Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 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
0
Question by FlippingFlopper · May 01, 2018 at 04:33 PM · debugstatic variable

any way that I can see which script has changed the variable?

I have a static boolean in a script, and few seconds later the played, I see the value of boolean variable is changed from true to false by Debug.Log. But Point is, there ISN'T any script containing value change for this static boolean. I'm pretty sure that there isn't any command changing its value, cuz I've double checked by correcting all the error messages after changing it's variable name. So I would like to know where on earth this value change has came from, if there's any way to know. Is there any way to see the change of variable? not the value itself, but which script has changed it. I'm working with C#.

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 fafase · May 01, 2018 at 05:12 PM 1
Share

Right click on the variable, then find all references, it will tell you where it is used.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by TreyH · May 01, 2018 at 05:06 PM

The Console already shows you the stack trace of Debug statements, so you can use that. Set your static bool as a property if it isn't already, then do something like:

 private static bool flag;
 public static bool Flag {
     get { return flag; }
     set {
         if (flag != value) {
             flag = value;
             Debug.LogFormat ("Changed!");
         }
     }
 }


That should print something to the console whenever the value changes, which will have a trace back to whatever made the assignment.

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 FlippingFlopper · May 31, 2018 at 08:46 AM 0
Share

Thanks!! :)

avatar image
0

Answer by Tanoshimi2000 · Jan 10, 2021 at 11:41 PM

[BUMP] I need to do what the title of this thread it. I have a prefab that I instantiate, and position, and my Debug.Log indicates that it was positioned correctly, but upon the first frame it's moved to a different location by another script. The only other script on this is a Behavior State controller from the Asset Store. I've looked in the main script, and I don't see anything that moves it, so it's probably happening in the State itself. I don't want to keep bothering the author, so if I could see where and why the position is being changed, I might be able to work around it.

Any help tracking which script is changing the position of a transform?

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 Kensho · Jan 22, 2021 at 09:07 PM 0
Share

https://github.com/handzlikchris/Unity.TransformSetterInterceptor

Check this out, should help your situation

avatar image Tanoshimi2000 · Jan 24, 2021 at 03:21 PM 0
Share

Now that seems like some functionality Unity should implement. Thanks for the answer, it seems like it would do what I need, but it also seems like a pretty complicated implementation. I'll need a day when I can focus on the task and spend time to get it working, I think.

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

84 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

Related Questions

Filing and debuging web plugin crashes 1 Answer

"It is not possible to invoke an expression of type 'boolean'" in switching cameras 1 Answer

Turn off blue mesh lines 2 Answers

Debug Wrapper Class 6 Answers

Bug!? Testing!? UnityEngineDebug.cpp line 43 - Need workaround 0 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