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 gearpichon · Oct 05, 2018 at 04:13 AM · editor-scriptingarraysruntimevector2editorgui

Array of vectors lost in runtime, but not null

I'am trying to set and array of vectors using a custom editor button so it is created out of runtime. The vector is ok and looks good but when I start the program and try to access the vector elements gives an error: "Array index is out of range" If I check if the vector is null it is not and if I check for example the element 0 of the array it still says it is not null. If a try to print the Length it gives me 0 so I am very confuse...also if I check the array in the inspector is say that it have a lot of elements but all in 0...some one can tell me whats going on? how can I keep the vector from the editor to the runtime scene?

I already did this with a normal vector of ints and it works.

thak you.

Comment
Add comment · Show 3
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 LCStark · Oct 05, 2018 at 05:08 AM 1
Share

Have you seen this answer? https://answers.unity.com/questions/1298321/custom-editor-script-resets-values-on-play.html

avatar image gearpichon LCStark · Oct 05, 2018 at 05:36 AM 0
Share

thank you! I was trying that that but following other similar answer and they didnt work, that one make it. I hava a question. Why only fails with the array of vectors? all the other variables are ok even the arrays of ints, floats and bools. That is weird for me.

avatar image LCStark gearpichon · Oct 05, 2018 at 06:46 AM 0
Share

I can't be sure (someone please correct me on this if I'm wrong), but my guess is that while all the standard C# data types are serialized, the more complex structs and classes of Unity are not. Also, I think all private fields have to be manually marked for serialization for that to work. Check out this page: https://docs.unity3d.com/$$anonymous$$anual/script-Serialization.html, it looks like it explains a lot of the serialization process in Unity. I'm going to read it myself as well. :)

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

106 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to customize editor to show, in an array of scriptA within scriptB, the public vars of each scriptA[n] element? 1 Answer

editor ObjectField specific folder 0 Answers

Any way to attach a bit of code to individual UI Windows [Editor] 1 Answer

How can i create a pup-up menu like the one for choose the shader on materials in unity 2019? 1 Answer

GetPropertyHeight infinite recursion on drawer 1 Answer


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