I am having some problem with running the game on the iPhone. The game runs fine in the editor, and it ran fine on the iPhone when I was still using Unity 1.7. However since I upgraded to Unity 3, I have been seeing this error whenever I use MessageList from Unity Wiki (http://www.unifycommunity.com/wiki/index.php?title=MessageList).
Unloading 81 unused Assets to reduce memory usage. Loaded Objects now: 563.
Unloading 3 Unused Serialized files (Serialized files now loaded: 0 / Dirty serialized files: 0)
ExecutionEngineException: Attempting to JIT compile method '(wrapper dynamic-method) UnityEngine.Object:Object$op_Implicit (object,object[])' while running with --aot-only.
at System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0
at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) [0x00000] in <filename unknown>:0
at System.Delegate.CreateDelegate (System.Type type, System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
at System.Reflection.Emit.DynamicMethod.CreateDelegate (System.Type delegateType) [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.CreateMethodDispatcher () [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.DynamicDispatching.Emitters.DispatcherEmitter.Emit () [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.RuntimeServices.EmitImplicitConversionDispatcher (System.Reflection.MethodInfo method) [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.RuntimeServices.CreateBoolConverter (System.Type type) [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.RuntimeServices+<ToBool>c__AnonStorey1E.<>m__15 () [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.DynamicDispatching.DispatcherCache.Get (Boo.Lang.Runtime.DynamicDispatching.DispatcherKey key, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.RuntimeServices.Dispatch (System.Object target, System.String cacheKeyName, System.Type[] cacheKeyTypes, System.Object[] args, Boo.Lang.Runtime.DynamicDispatching.DispatcherFactory factory) [0x00000] in <filename unknown>:0
at Boo.Lang.Runtime.RuntimeServices.ToBool (System.Object value) [0x00000] in <filename unknown>:0
at MessageList.AddMessage (System.String messageText) [0x00000] in <filename unknown>:0
at Dialog_cutscene_1_0+$DisplayMessages$1056+$.MoveNext () [0x00000] in <filename unknown>:0
(Filename: Line: -1)
And here's the code for MessageList:
// MessageList.js
// From the Unity Wiki
// Use with TimedFadeText.js
// Attach to an emtpy Game Object
var messagePrefab : GUIText; // The prefab for our text object
var lineSize : float = 20.0; // The pixel spacing between text objects
var startPos : Vector3 = Vector3 (20, 20, 0); // The position GUIText objects will be instantiated
var layerTag : int = 0;
var insertAbove : boolean = true;
private var messages = new Array(); // The array that holds all our text objects
private var directionFactor : float = 1.0;
// Provide singleton support for this class.
// The script must still be attached to a game object, but this will allow it to be called
// from anywhere without specifically identifying that game object.
static private var messageListInstance : MessageList;
static var instance : MessageList;
static function Instance () {
if (!instance) {
instance = FindObjectOfType (MessageList);
if (!instance)
Debug.LogError ("There needs to be one active MessageList script on a GameObject in your scene.");
}
return instance;
}
function Awake () {
// First make sure that we have a prefab set. If not, then disable the script
if (!messagePrefab) {
enabled = false;
Debug.Log("Must set the GUIText prefab for MessageList");
}
if (insertAbove) {
directionFactor = 1.0;
}
else {
directionFactor = -1.0;
}
}
// AddMessage() accepts a text value and adds it as a status message.
// All other status messages will be moved along the y axis by a normalized distance of lineSize.
// AddMessage() also handles automatic removing of any GUIText objects that automatically destroy
// themselves.
function AddMessage (messageText : String) {
// Itterate through the messages, removing any that don't exist anymore, and moving the rest
for (var i = 0; i < messages.length; i++) {
// If this message is null, remove it, drop back the i count, and jump back to the begining
// of the loop.
if (!messages*) {*
*messages.RemoveAt(i);*
*i--;*
*continue;*
*}*
*// If this message object does exist, then move it along the y axis by lineSize.*
*// The y axis uses normalized coordinates, so we divide by the screen height to convert*
*// pixel coordinates into normalized screen coordinates.*
<em>(messages _as GUIText).transform.position.y += directionFactor * (lineSize/Screen.height);_</em>
_*}*_
_*// All the existing messages have been moved, making room for the new one.*_
_*// Instantiate a new message from the prefab, set it's text value, and add it to the*_
_*// array of messages.*_
_*var newMessage : GUIText = Instantiate(messagePrefab, Vector3(startPos.x/Screen.width, startPos.y/Screen.height, startPos.z), transform.rotation);*_
_*newMessage.text = messageText;*_
_*newMessage.gameObject.layer = layerTag;*_
_*messages.Add(newMessage);*_
_*}*_
_*```*_
_*<p>And finally, this is my script that controls the scene:</p>*_
_*```*_
_*//this is where dialogs are defined and the timing to display them are defined.*_
_*//used in combination with MessageList.js http://www.unifycommunity.com/wiki/index.php?title=MessageList*_
_*var CameraInUse : GameObject; //define the camera being used in the scene*_
_*var SceneSpeed : float = 1; //this adjusts the speed at which the dialogs and cutscene is played. Note: the GUITextMessageList prefab controls the fade out and live time speed of the text on screen. (multiply the live time and fade time by the same SceneSpeed number)*_
_*function Start () {*_
_*DisplayMessages();*_
_*}*_
_*function DisplayMessages(){*_
_*//find the sound effect manager to play sounds*_
_*var PlaySoundHere : SoundEffectManager = GameObject.FindWithTag("SoundEffects").GetComponent(SoundEffectManager);*_
<em>_iTween.moveBy(CameraInUse,{"x":2.5, "y":1.25, "z":0, "time":SceneSpeed*25, "delay":SceneSpeed*0, "transition": "linear"});_</em>
<em>_yield WaitForSeconds(SceneSpeed*1);_</em>
_*MessageList.Instance().AddMessage("One quiet evening in London,");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("Most people have just finished their day.");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("Some are on their way to the pub.");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("Some are about to have dinner with their sons and daughters.");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("And some are brushing their teeth, getting ready for an early night...");*_
<em>_yield WaitForSeconds(SceneSpeed*6);_</em>
_*MessageList.Instance().AddMessage("When all of a sudden...");*_
<em>_yield WaitForSeconds(SceneSpeed*1);_</em>
_*PlaySoundHere.PlayEarthquake(); // start playing earthquake sound loop*_
<em>_iTween.shake(CameraInUse,{"x":.5, "y":.1, "z":.5, "time":SceneSpeed*5, "delay":SceneSpeed*0});_</em>
<em>_yield WaitForSeconds(SceneSpeed*5);_</em>
_*PlaySoundHere.StopEarthquake(); // stop playing earthquake sound loop*_
<em>_iTween.moveBy(CameraInUse,{"x":-10, "y":2.5, "z":0, "time":SceneSpeed*25, "delay":SceneSpeed*0, "transition": "linear"});_</em>
<em>_iTween.rotateBy(CameraInUse,{"x":.015, "y":.02, "z":0, "time":SceneSpeed*25, "delay":SceneSpeed*0, "transition": "linear"});_</em>
_*MessageList.Instance().AddMessage("'An earthquake???!!'");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("'But we never have earthquakes in London!'");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("'What is it???'");*_
<em>_yield WaitForSeconds(SceneSpeed*6);_</em>
_*MessageList.Instance().AddMessage("Nobody knows the answer, but everyone soon forgets about it.");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("... well ...");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("ALMOST everyone ......");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*MessageList.Instance().AddMessage("");*_
<em>_yield WaitForSeconds(SceneSpeed*3);_</em>
_*//disable click indicator from being created*_
<em>*var loadingMessageObject = GameObject.Find("Loading_Message");*</em>
<em>*var loadingMessageScript : loading_message = loadingMessageObject.GetComponent(loading_message);*</em>
_*loadingMessageScript.LoadNextLevel();*_
<em>*// Load the scene named "cutscene_1_1".*</em>
<em>*Application.LoadLevel ("cutscene_1_1");*</em>
_*}*_
_*```*_
_*<p>I've tried .net2.0, .net2.0 subset, but it didn't make a difference. Any ideas? </p>*_
_*<p>Thanks!</p>*_