Script assigned inside a script does not work on IOS
I have a script which is for creating cylinders inside a for loop. This script than assigns another script (ButtonScript) to those newly created cylinders.
for (int i = 0; i < objProArray [1]; i++) {
cylinder = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
cylinder.AddComponent<ButtonScript>();
}
I assign this script to a null object. It works fine on editor. However, if I build it for IOS and try on the iphone, buttonScript does not do its job.
However, if I create an object manually and assign the buttonScript
again manually, it works fine both on editor and iphone.
So, I suspect there is something wrong with cylinder.AddComponent<ButtonScript>();
Any ideas?
What does ButtonScript do (paste code please)? Is it something that doesn't work on mobile platforms? And not sure what you mean when you say you assign the script to a null object. You can't do anything with a null object... you'd get a null reference error. When the app is deployed to the phone does XCode's output log show errors?
Your answer

Follow this Question
Related Questions
how to build project in unity for IOS platform? 0 Answers
How to Solve the Google Ads Problem In Ios? 0 Answers
Read and save current git commit hash into script 1 Answer
Implementing IOS IAPs 0 Answers