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 Jul 06, 2014 at 10:38 PM by QuestionAsker for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by QuestionAsker · Feb 05, 2014 at 01:49 AM · glitchfatal errorconstructorsfatal-error

Simple Code that crashes Unity for some strange reason!

The beggining of the code below is my constructor, the end is the function it calls.

 this.storage = InititalizeStorage(_colsAvailable, _rowsAvailable);
 }
 
 private InventorySlot[] InititalizeStorage(int cols, int rows)//, GUIStyle _style)
 {
     InventorySlot[] storageSlots = new InventorySlot[cols * rows];
     
     for(int i = 0; i < storageSlots.Length; i++)
          storageSlots[i] = new InventorySlot(null);//, _style);
         
     
     return storageSlots;
 }

When InitializedStorage is called from another function in start it works fine. So my only question is why does unity say "Fatal Error! Allocating memory when not allowed to"?

Comment
Add comment · Show 2
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 AaronWinterhoff · Feb 05, 2014 at 03:25 AM 0
Share

Hey, can we see your InventorySlot Struct (or class)?

What line is the fatal error occuring on? What's the full debug message?

The code works fine on my computer, with large ints as colums and rows, using a struct with a constructor.

avatar image QuestionAsker · Feb 05, 2014 at 03:36 AM 0
Share

I cant acess my computer, it defragmenting, but I can type it by hand... something says it wont help.` public class InventorySlot {

public Item item; public bool empty;

public InventorySlot (Item _item) { this.Item = _item; this.empty = false;

    if(_item == null)
        this.empty = true;

  

}`

1 Reply

  • Sort: 
avatar image
0

Answer by ffxz7ff · Feb 05, 2014 at 01:55 AM

Not sure about the Fatal Error, but it could have to do with the fact that

 storage[i] = new InventorySlot(null);//, _style);

is probably supposed to be

 storageSlots[i] = new InventorySlot(null);
Comment
Add comment · Show 1 · 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
avatar image QuestionAsker · Feb 05, 2014 at 01:57 AM 0
Share

$$anonymous$$y bad. It was a typo. Thats what the code actually is, and ive edited above. I wish it was that simple of a fix. Thanks!

Follow this Question

Answers Answers and Comments

20 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

Related Questions

How can I reset unity 3d? 2 Answers

[Fatal Error] (macOS) Quit and get error "GetManagerFromContext: pointer to object of manager 'InputManager' is NULL (table index 1)" 5 Answers

monodevelop built in gives me fetal error even after i downloaded the gtk# for the web and installed it on my device it still gives me this error are there any way that i can fix this problem 1 Answer

Fatal Error! 0 Answers

Fatal error in gc: too many threads 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