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 /
This question was closed Dec 06, 2014 at 12:36 AM by Kiwasi for the following reason:

Other: Question is not answerable.

avatar image
-3
Question by Theacesofspades · Dec 05, 2014 at 11:34 PM · c#gameobjectvariablebyte

Help with basic variable byte

why cant i do this? How can i do this:

 byte levelData[x, y, z] = gameObject;
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 thepenguinmaster · Dec 06, 2014 at 02:27 AM 0
Share

It looks like what you are trying to do is convert your gameobject to a byte array. To do this you need a BinarySerializer. This will change it into a one dimensional byte array and not a three dimensional byte array.

What need do you have for the x y and z? I would imagine you expect some existing values in the game object to be stored, but this is not a correct use of a byte array.

I would read about how a multidimensional array works. http://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx

What is your expected outcome from the psuedo code you posted above? What are you trying to accomplish (the result)?

1 Reply

  • Sort: 
avatar image
2

Answer by Bunny83 · Dec 05, 2014 at 11:47 PM

-1

Uhm your code makes no sense at all so the simple answer is:

Not at all

Some more points:

  • Having the type "byte" in front of an identifier usually declares a variable of type "byte".

  • When declaring a type you can't use indexing brackets on the name at the same time. If you want to declare an array the brackets belong to the type.

  • In case the "byte" word is removed the line of code would be valie if levelData is a 3 dimensional array of GameObject. However if it's a 2d array of byte values you can't store a GameObject in it.

All in all your question makes no sense at all. You should explain what you want to do because we can't derive that from that code snippet.

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

Follow this Question

Answers Answers and Comments

27 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

Related Questions

Assigning current color to a variable for fade out (C#) 0 Answers

Distribute terrain in zones 3 Answers

How to access gameObject variable script 2 Answers

Debug.Log a gameobject in C ? 2 Answers

Multiple Cars not working 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