Saad Khawaja Menu

Permalink:

Solution: ‘MEMORYSTREAM’ IS CORRUPTED! REMOVE IT AND LAUNCH UNITY AGAIN! [POSITION OUT OF BOUNDS]

You must have come across this error which is why you’re viewing this page:

‘MEMORYSTREAM’ IS CORRUPTED! REMOVE IT AND LAUNCH UNITY AGAIN! [POSITION OUT OF BOUNDS]

The bug was reported to Unity here:

https://issuetracker.unity3d.com/issues/the-file-memorystream-is-corrupted-remove-it-and-launch-unity-again-position-out-of-bounds

 

The proposed solution from the message is: Launch Unity again which does not work. Even restarting the system and relaunching Unity does not work.

The Unity team was unable to reproduce this issue so as a result, there is no official solution. However, after hit and trial I have deduced that the problem is caused by Unity Remote – attached iOS Device.

 

Solution:

1. Open Editor Settings (Edit->Project Settings->Editor)

position out of bounds

 

2. Select device to None

3. Save Project

4. Quit Unity

5. Relaunch Unity and the problem must be solved.

  • eont

    But how can I launch unity if it won’t open due to the bug?

  • Norbert

    Unfortunately, even in Unity 5.5 the Problem appears to be worse. As Unity no longer loaded my Project with this bug (Crash upon Startup), I thought it was a good idea to upgrade from 5.4 (where the bug appeared first) to 5.5. The Project was correctly converted and loaded after first start of Version 5.5. I felt really happy about this … I could work normally work with the whole Project. But, after save and restart of Unity, it now crashes again. So, my Project is currently lost ….. it seems as if even older, archived Versions of the Project do migrate once, then Crash …. any help is appreciated !

  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

Instant Hi-Res Screenshot

So upon popular request, I’ve decided to make an editor extension of my Screenshot Script.

It now works like a charm! Just import the package in any project and goto -> Saad Khawaja -> Hi-Res Screenshot

 

You can now take High Resolution Screenshots of your Unity Game right from the Scene View as well at the click of a button!

Features:

  • Take the Hi-Res Camera Render Screenshot (with/without alpha channel)
  • Set your own resolution
  • One click from the Scene/Game View

 

Screenshots:

Screen Shot 2014-10-21 at 3.38.02 am

 

 

 

Download:

http://www.saadkhawaja.com/freebies/InstantScreenshot.unitypackage

  • Malcolm

    Hey I tried this on this on the store, it works great. Could you please release a paid version that remembers the settings you choose last time, I would like to buy it. Or just add that feature to the free version and I can send you some money via paypal. Right now the screenshot tool resets the interface each time I restart unity.

  • gareth

    Is there a limit to the resolution that can be generated?

  • •••
  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

endlessPreview

2D Endless Jumper Game Kit

Permalink:

df02ddd8-d5f9-45f6-b8c1-f6360970267c_scaled

2D A* Grid Based Pathfinding in Unity3D

  • kardilah

    I bought “Grid-Based 2D pathfinding” you make, but I have difficulty to detect that AstarEnemy lines should not be shut down by a defender (tower). please help thank you

  • joe

    not free you liar

  • •••
  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

Play a specific frame of Animation (Legacy)

Unity does not have a method to goto a specific frame per say. But you can move to a specific time interval of an animation using Gameobject.animation["name"].time – Legacy Animation

So in short, you can actually goto a specific frame by finding the time of the animation at that particular frame. e.g. If the animation speed (visible in the animation window) is 24 fps: It means 24 frames are rendered in 1 sec.

The first frame will be at 1/24 * 1. The second will be at 1/24 * 2. and so on.

So this snippet will do the trick:

gameobjectname.animation.Play ("Take 001");
gameobjectname.animation.Stop ();
gameobjectname.animation["Take 001"].speed = 0; //to make the animation pause
gameobjectname.animation["Take 001"].enabled = true;
gameobjectname.animation["Take 001"].time = (1f/24f)*frameNumber;
  • Smithc669

    I truly appreciate this post. I have been looking all over for this! Thank goodness I found it on Bing. You’ve made my day! Thanks again! aeddcaddgbgdaeef

  • martin

    i was looking at this for my own use and im sure it will work however im not sure how to initialise frameNumber and the code is deprecated from unity 5 trying to swap this for GetComponent works fine for .Play but not the rest it seems any ideas?

  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

  • sai

    But how to screenshots with batch mode?

  • Helda Bbt

    Peut ton récupérer les captures faire dans un groupe d’objets genre Texture2D []??

  • •••
  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

Get Time from the Server

A common error that developers make is that they use the time on the device for various game play elements.

For e.g. A game that requires the user to wait 2 hours before making another element.

This can be easily hacked by changing the device date/time. So, in order to stop cheating, you must get time from the server and compare the current time with that.

 

The easiest solution would be to make a PHP page and print time in it.

Then use WWW in Unity to query the page and get time.

 

PHP

  1. <?php
  2. print date(“G.i:s”, time());
  3. ?>

UNITY

void Start () {
        StartCoroutine("getTime");
 
    }
 
    IEnumerator getTime()
    {
        WWW www = new WWW("http://www.saadkhawaja.com/gettime.php");
        yield return www;
 
        Debug.Log("Time on the server is now: " + www.text);
    }
  • nobody

    hi, can you make the php include the date also ?
    it mean so much for me,
    thank you

  • asd

    hi, im using this solution… btw i’ve made my script to load on my server with apache, but unfortunately it require a user\pass to get the page load… if I put my page in CS script i got 401 error authentication required… do you know anyway to bypass that?

  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.

Permalink:

Move Object with Mouse

Move a 3D Object with Mouse – and make it collide

  • Melvin

    Awesome just what I needed! One question though, I’m doing this for a 2D Air Hockey game. I got the code to work, but when my paddle goes real quickly against the puck, then it goes through the puck. I tried this code in both FixedUpdate() and Update(). This is probably the case, because the move happens so quick, that the Unity engine does not check for collision in that fast mouse movement. I’m currently thinking of ways how to fix this, but perhaps you have a good idea for this?

  • qwertyuiopasdfghjklzxcvbnm

    on your rigidbody, change collision detection to continuous instead of discrete

  • Thanks for leaving a comment, please keep it clean. HTML allowed is strong, code and a href.