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 SolAureus · May 17, 2016 at 04:21 AM · inspectorarraysscriptableobjectcustom-inspector2d array

Implementing a 2D array as a field on a ScriptableObject?

Some quick background: I'm making a 2D game, and I'm storing abilities as ScriptableObjects for ease of implementation.

I'm looking to implement a 2D array (or at least something functionally similar) as a field for my ability ScriptableObject:

alt text

I'm still new to programming, so I've mostly been looking up tutorials on various concepts that I'm unfamiliar with, and I followed this tutorial to create a script that has a 2D array of bools that would be functionally similar to what I was looking for (Panel oirign would be a seperate field that I would set manually, the bools would just determine which panels were hit): https://www.youtube.com/watch?v=uoHc-Lz9Lsc

My plan was to make a script like that (but 3x8) and attach it to each ability similar to how I attach the prefab for the FX. My thought was that if I were to do that, each ability would have its own instance of that script, and as such its own array of panels that were marked as "true" that I could reference. However, I seem to be unable to attach the script to my ScriptableObject at all. I called the class RangeResolver (what the tutorial video used "TestScript" for) and tried setting a public RangeResolver attackRange field in my ability ScriptableObject, but I cannot drag or select a script onto that field in the inspector.

I'm completely at a loss on how to proceed. If anyone has any ideas on how I can implement a 2D Array on a ScriptableObject as a field and how I can access the information in said array, I would be super grateful!

-customgridhelp.png (124.3 kB)
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 SolAureus · May 17, 2016 at 02:54 PM

So the solution to using the 2d bool array from the tutorial ended up being much simpler than I thought it would be. In the tutorial, the user created a TestScript.cs that only had 1 field which called the ArrayLayout class, which is where they defined the array of arrays that was used for their 2D array. I was attempting to call the actual TestScript class instead of the ArrayLayout class itself, so by calling public ArrayLayout attackRange, it worked exactly in the manner that I had hoped, at least for the bool array. I'm going to go with a manual setting of the origin panel and the bool array as the highlighted panels as my solution.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How should I serialize data that is also editable in the Inspector? 2 Answers

How to change inspector with non-Monobehaviour objects ? 1 Answer

Editing custom types in the inspector 1 Answer

Public field Range() not working inside ScriptableObject 2 Answers

Edit existing editor inspector? 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