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 Loken_01 · Nov 30, 2014 at 04:31 PM · variablesreflectionconsole

In-Game Console and Permanent Variable Changes

Hey Guys!

So I have spent the last few hours getting to grips with Reflection and MethodInfo, etc,
And I've managed to write a custom in-game console which displays all functions with a specific key word, and their parameters(types, and optional), etc.

The way I call the functions across every asset using the targeted script is with:
"MethodInfo.Invoke"

The problem I'm having now, is that any public variables I change in game, such as whether a component is enabled, it keeps that state upon existing play mode.

It was my belief that the variables returned to their original/user-defined state upon returning to editor mode.

Am I doing something wrong?
Or am I going to have to create private versions of everything I want to edit with the console, and set them from the public on Start?

Thanks in advanced guys!
Oh and you can have the console script if you want!
It can call any function with any number of parameters!
(I've only written a parser for int, float, string, Vector2 and Vector3 so far)

Thanks again!

Comment
Add comment
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

1 Reply

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

Answer by Loken_01 · Nov 30, 2014 at 10:43 PM

Hey Guys!

I actually fixed it, and figured I should post the solution in case anyone else has this problem.

My console was invoking a method I chose for every 'MonoBehaviour' of the Method's matching System.Type;

The problem was that it wasn't just affecting the instantiated game-time version,
but the inspector version too.

The simple solution was when I was invoking a method, making sure that the 'MonoBehaviour's 'HideFlags' were equal to 'None'!

So! Done and dusted!

Thanks again guys!

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

2 People are following this question.

avatar image avatar image

Related Questions

Use a String Variable to Dynamically Invoke a Method 1 Answer

SendMessage vs MethodInfo.Invoke 1 Answer

Anyone know how to get Type.GetMethods( ...) to return private methods? 1 Answer

How to refrerence a changing variable without using GetComponent 4 Answers

I'm unable to clear a variable that is used in multiple scripts. 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