question

simeon avatar image
simeon asked

iOS build - xcode ignore playfab scripts (beginner),ios build - xcode completely ignores playfab scripts (beginner)

Hello,

first, thank you. I am not not a tech savvy guy. But thanks to the example I could achieve my purpose in in unity editor using the progressive rewards from the playfab recipe.

I just attached the progressive reward script to an object in my scene in unity. then wrote a simple script to check if its there.

here is what I wrote

void Start () {
progressiveRewardObject = GameObject.FindWithTag ("ProgressiveReward");
if (progressiveRewardObject != null) {<br>progressiveReward = progressiveRewardObject.GetComponent <ProgressiveRewards> ();<br>} else {
Debug.Log ("can't find Progressive Reward Object");
}
}

void Update () {
if (progressiveReward != null ){
// do something
} else {
Debug.Log ("can't find Progressive Reward script");
}
}

Everything works fine until the Xcode nightmare begins.
Has you can see (on the screenshot) a lot of code never gets executed and the ProgressiveReward is ignored. Did I miss something important ? like having to download both Unity and ObjectiveC SDK or something?

I work with Unity 5.5 xcode 8.2 on MacOS 10.11.

Any feedback would help. Thanks!

Sim

sdks
screen-shot-error.jpg (172.5 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
1807605288 avatar image
1807605288 answered

Hello!

Your example code does not call any PlayFab code. You are not having PlayFab issues, you are having Untiy issues. However, I'll give you a quick answer to help you get started. Please refer future Unity questions to the Unity answers forum.

Based on the code you gave us, it seems your code cannot find your gameObject.

Replace the "FindWithTag" line with: "progressiveRewardObject = gameObject;". Your component is already part of a gameObject, you don't need to do a scene search for it.

Replace the "GetComponent" line with: "progressiveReward = this;". Your code is the component. If the component didn't exist, your code would not execute.

When searching for GameObjects, FindObjectOfType<ProgressiveRewards>() is more generic than FindGameObjectWithTag(). In the latter case, the gameObject will not be found unless you add a tag to it. Components are not Tags. See the Unity Documentation for more information.

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

simeon avatar image simeon commented ·

Thank you Paul!

You are right ! It is not a Payfab issue. After your answer I decided to just do the progressive reward recipe step by step. Xcode can build the project without issue.

github - ProgressiveRewards Recipe

Now I have search for the issue elsewhere and cry myself to sleep.


0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.