Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 AMeyers624 · Oct 04, 2016 at 08:46 PM · c#gameobjecteditorwindow

EditorWindow that changes properties of a custom gameObject

Hello.

I'm attempting to create a custom heightmap/3D noise gameobject. I don't want to get one from asset store because I'm doing this to learn. The actual object, for the most part, works as designed. So, to extend functionality/convenience, I wanted to play around with GUI controls. I've got the basics of making an inspector. I understand the idea of the serialized game object. I was running into troubles with getting NULLs when trying to findProperty, but I got it.

So, if it helps, my gameobject really is node based, and the "root" really contains one node. That node can be either an arithmetic operation, or an algebraic representation of shape. Essentially, all the "leaves" are shapes or gradients. Then I extract a the value of the X,Y,Z of that "function". This is just how I know I can do it, pointers would be nice, but I kind of proud of my juvenile thing, and it has room to grow. The limited part is, I basically have to construct the whole "tree" by hand, with several nested constructor calls.

So, my problem really comes into with how I want my GUI tools to work. I want to attach a button to my inspector(done, no problems), that launches a window(which I kinda figured, so I don't think I'm really asking about the OnGUI line by line creating of the fields and buttons), which affects the properties of that one gameobject, and this is where I'm failing. I don't think I'm effectively finding the right gameObject or serializedObject or whatever.

At first, I was hoping to use the Show method I was making in that, and have a parameter of the object to give to, but the variable I want to assign it to "technically doesn't exist" at that point, so I don't know how to keep it persistent with that approach. Then I was trying to call another method right after launching the window, but I failed on the that approach, but then I started use the darn Find object, and then serialize it, then try to create the GUI with a similar approach I used in my inspector. That way, I'm getting NULL errors again, and my menu does nothing to change any properties of the game object. So, now I'd thought, I need someone smarter, even for a few seconds. Plus, I kinda get impression that if I make more than one of the object, it may not get the specific one I want.

I'd post code, but I've already gave a lot in paragraph form, and I don't want to over complicate it.

How can I effectively store the object in my menu class to make changes to it like I would in the inspector? Please consider, that the only way to open this menu will be from that objects Inspector.

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

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Distribute terrain in zones 3 Answers

Multiple Cars not working 1 Answer

Game freezes everything when calling WaitForSeconds 1 Answer

Update character's position after animation 1 Answer

Is there anyway to batch renaming via Editor [not on Runtime] multiple game objects in the hierarchy ? 4 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