Very strange scripting [C#] problem

I recently posted this thread: Graphic content not loading when testing on IOS simulator - Unity Engine - Unity Discussions (Graphic content not loading when testing on IOS simulator). As this seems to be a scripting issue i place this part of the post here, sorry if this should have been posted in the previous post.

All is working in the Unity3D editor, this post reflects what is happening in the XCODE IOS simulator!

After quite a lot of debugging i think i have identified the problem, which I do not understand at all.

When i use the following code it works meaning the content, in temp_GameObject, appear in the XCODE IOS simulator:

//Clear the master_GameObject_List
Singleton.Instance.master_GameObject_List.Clear ();

//load master game object list with backside up
temp_GameObject = Resources.Load ("BackSide") asGameObject;

foreach (string aCard in cardDeckBackListNames) {
    temp_GameObject = Instantiate(Resources.Load("BackSide")) asGameObject;
    temp_GameObject.name = aCard;
    temp_GameObject.tag = aCard;
    temp_GameObject.transform.localScale = new Vector3(0.77f, 0.77f, 0f); <<<<<<<<
    //temp_GameObject.transform.localScale = cardScaleVector;
    temp_GameObject.transform.renderer.sortingLayerName = "Card";
    Singleton.Instance.master_GameObject_List.Add(temp_GameObject);
}

When i use the cardScaleVector it does NOT show the temp_GameObject in the XCODE simulator, below:

//Clear the master_GameObject_List
Singleton.Instance.master_GameObject_List.Clear ();

//load master game object list with backside up
temp_GameObject = Resources.Load ("BackSide") asGameObject;

foreach (string aCard in cardDeckBackListNames) {
    temp_GameObject = Instantiate(Resources.Load("BackSide")) asGameObject;
    temp_GameObject.name = aCard;
    temp_GameObject.tag = aCard;
    //temp_GameObject.transform.localScale = new Vector3(0.77f, 0.77f, 0f);
    temp_GameObject.transform.localScale = cardScaleVector; <<<<<<<<
    print ("cardScaleVector: " + cardScaleVector);
    temp_GameObject.transform.renderer.sortingLayerName = "Card";
    Singleton.Instance.master_GameObject_List.Add(temp_GameObject);
}

I get the following from the print statement: “cardScaleVector: (0.8, 0.8, 0.0)”.

The below code does not work, nothing show up.

//Clear the master_GameObject_List
Singleton.Instance.master_GameObject_List.Clear ();

//load master game object list with backside up
temp_GameObject = Resources.Load ("BackSide") asGameObject;

foreach (string aCard in cardDeckBackListNames) {
    temp_GameObject = Instantiate(Resources.Load("BackSide")) asGameObject;
    temp_GameObject.name = aCard;
    temp_GameObject.tag = aCard;
 
    //temp_GameObject.transform.localScale = new Vector3(0.77f, 0.77f, 0f);
    //temp_GameObject.transform.localScale = cardScaleVector;

    float x1 = cardScaleVector.x;
    float y1 = cardScaleVector.y;
    temp_GameObject.transform.localScale = newVector3(x1, y1, 0f);

    print ("x1: " + x1 + " || y1: " + y1);
    temp_GameObject.transform.renderer.sortingLayerName = "Card";
    Singleton.Instance.master_GameObject_List.Add(temp_GameObject);
}

print from the above: “cardScaleVector: (0.8, 0.8, 0.0)”

The problem is related to the cardScaleVector, it work when i define the x1/y1 with 0.77f directly but not via cardScaleVector even if it prints the correct value. The cardScaleVector is read from PlayerPrefs. Again, it works perfectly in the Unity3D editor.

I am able to read the correct value from the cardScaleVector but obviously not able to read it when in XCODE simulator.

I am totally totally lost.

Problem partly solved:
I have solved the basic problem by finding a second PlayerPref read for cardScaleVector that i deleted. However, I still do not understand why it worked in the Editor but not in XCODE. However, i guess i have to accept it as it now works :slight_smile: