Hi,
going through initial learning phase, I am trying to learn C#/Unity/iPhone dev.
I managed to get the initial things sorted (Apple certificates, xcode setup, mono dev setup with Unity, Unity set up with bundle identifier… now I have Unity 3 able to build and run with app going to my iPhone4). as a noob I am happy that at least I got all of this sorted for now
To get going with Unity/C# combo I was following 3DBuzz simple shooter tutorial, and it is just fine if I use build settings for Mac Standalone. no probs. But what I am really interested in is iPhone development so I am using the Simple Shooter tutorial as a reference and converting what I learn to iPhone iOS development which so far at least for player control in c# means using different code, well of course the iphone does not have input via arrow keys and asdw keys, so I went on using Vector2 touchDeltaPosition / input.GetTouch, etc… this way I can move my cube around with my finger.
What I can’t get to work for now is having my cube to wrap from one side of the screen to the other when it goes off screen. I tried the code from buzz which ‘logically’ is simple to understand (and it works if I build for Mac) but it doesn’t work if I build for iOS, unity iOS does not like Vector 3, the arguments , etc…
//wrap
if (transform.position.x <= -6.2f)
transform.position = new Vector3(6.2f, transform.position.y, transform.position.z);
else if (transform.position.x >= 6.2f)
transform.position = new Vector3(-6.2, transform.position.y, transform.position.z);
ERROR MESSAGE: Assets/Scripts/Player.cs(17,123): error CS1502: The best overloaded method match for `UnityEngine.Vector3.Vector3(float, float, float)’ has some invalid arguments
That same code was fine if building for Mac standalone
So I tried different solution using Vector 2 (x, y). Using touchDeltaPosition instead using transform.position with overall different code of curse etc… but what I came up with didn’t work.
- is it just me (as in noob) or is it the case that when coding for iPhone there are things that cannot be used for example vector 3 or transform.position.x - Is there somewhere in the documentation info about what (if any) c# cannot be used for iphone with indication of correct way to do it.
Not sure if what I just wrote makes sense but if it does, thank you for your help