CharacterCustomization

I have a CharacterCustomization project that has been converted to iOS. The project ran fine under OS X, but crashes on the iPhone during character spawning.

Main.js code snippet

while(true)
go.Instantiate(prefab);
go.transform.position = new Vector3(Random.value * 10, 0, Random.value * 10);

This code generates this error when I try to build the iOS project:

transform is not a member of UnityEngine.Object

Character.js snippet

GetComponentInChildren(ParticleEmitter).emit = false

This code works fine in the game simulator but generates a runtime error on the device: EXC_BAD_ACCESS from AssetBundleUtility which tells me some object is not being found on the device by the loader.

Running iOS v4.2 on iPhone & iPad

**EDIT

As crucial to writing Unity apps as both of these techniques are, I just don't understand why there isn't an iPhone equivalent posted in example apps in the first place.


HERE'S THE ENTIRE CODE FOR BOTH


CHARACTER.JS

var character : String;
var config : String;
var anim : String = "walk";

// Allow the CharacterElementDatabase to be downloaded.
while (!CharacterGenerator.ReadyToUse) yield;

// Configure a CharacterGenerator according to the configuration strings.
if (character == "")
    generator = CharacterGenerator.CreateWithRandomConfig();
else if (config == "")
    generator = CharacterGenerator.CreateWithRandomConfig(character);
else
    generator = CharacterGenerator.CreateWithConfig(character + "|" + config);

// Give the particle system some time to grow.
yield WaitForSeconds(2);

// Wait for the assets to be downloaded.
while (!generator.ConfigReady) yield;

// Create the character.
go = generator.Generate();

// Attach the character to this prefab so we can move it around.
go.transform.parent = transform;
go.transform.localPosition = Vector3.zero;
go.transform.localRotation = Quaternion.identity;

// Play and loop the specified animation.
go.animation.Play(anim);
go.animation[anim].wrapMode = WrapMode.Loop;

// Stop emitting particles, as the character now exists.

GetComponentInChildren(ParticleEmitter).emit = false;

MAIN.JS

var prefab : GameObject;

// This script creates a character prefab every 3 seconds,
// and places it at a random position.

while(true)
{

    go = Instantiate(prefab);
    go.transform.position = new Vector3(Random.value * 10, 0, Random.value * 10);
    yield new WaitForSeconds(3);
}

Surprisingly... It means what it says...

http://unity3d.com/support/documentation/ScriptReference/Object.html

As clearly seen, transform isn't a member of the Object family.

So go must be a Object, NOT a GameObject which would work...

Posting more script could help more directly, but this should give you a hint.

It could run on iPhone, I had did that. You should generate AssetBundles for iPhone and modify some scripts to do that. It’s easy to convert to iPhone.

It could run on iPhone, I had did that. You should generate AssetBundles for iPhone and modify some scripts to do that. It’s easy to convert to iPhone.