Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by cloned31 · Jan 25, 2017 at 06:49 PM · iostexturerendererandriodcreateprimitive

Textures are pink on iOS Build

I've been having trouble with and GoogleVR app on an iOS device.

My first issue was a null pointer error. This happened while in XCode but not in Unity (EXC_BAD_ACCESS code = 1) I fixed this after looking around in the API documentation on the "Create Primitive" function, specifically the part where it will crash.

CreatePrimitive may fail at runtime. This will happen if your project does not reference the following components: MeshFilter, MeshRenderer, and BoxCollider or SphereCollider at runtime.

So I added all of those elements to each GameObject (even though Unity told me in the Editor they already those components.)

Also, keep in mind this works perfectly on Andriod builds, where those additional objects are implied in comparison to iOS. (I assume? If anyone could provide a more technical/correct explanation that would be lovely.)

Nevertheless, finally, I had no crashing when installing to the iOS device! Yay! ...But pink textures. Boo!

So I've tried several things: First I tried changing the color by accessing the material in MeshRenderer and changing it to the appropriate color; that didn't work. Then I tried doing the original way by accessing the Renderer component and setting the material to the desired color; that didnt work either. Finally, when looking around at some of the questions I found one possible solution which was setting the Built-in shader "Deferred" from "Built-In Shader" to "No Support"; and alas that did not work either.

So I'm quite at a loss here and I would like to keep everything as self-contained as possible i.e. all in one script, such as the one below. If anyone could be kind enough to provide a solution or probe me for more detail, I would be very grateful. Also, if anyone is curious, the image is just supposed to be a ball-and-stick representation for a water molecule.

 using UnityEngine;
 using System.Collections;
 /***********************/
 //Drawing a water molecule
 /***********************/
 public class water : MonoBehaviour
 {
     // Use this for initialization
     void Start()
     {
         GameObject[] atoms;
         float[] covalRadii = { 0.37f,0.73f};
         //First create each atom as a sphere using XYZ coordinates
         GameObject h1 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
         h1.AddComponent<MeshFilter>();
         h1.AddComponent<MeshRenderer>();
         h1.AddComponent<SphereCollider>();
         GameObject h2 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
         h2.AddComponent<MeshFilter>();
         h2.AddComponent<MeshRenderer>();
         h2.AddComponent<SphereCollider>();
         GameObject o1 = GameObject.CreatePrimitive(PrimitiveType.Sphere);
         o1.AddComponent<MeshFilter>();
         o1.AddComponent<MeshRenderer>();
         o1.AddComponent<SphereCollider>();
         //Then set their positions
         h1.transform.position = new Vector3(0.96f, 0.0f, -0.27f);
         h2.transform.position = new Vector3(0.0f, 0.0f, 1.0f);
         o1.transform.position = new Vector3(0.0f, 0.0f, 0.0f);
         //Set size
         h1.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
         h2.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
         o1.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f);
         //Now tag each one with the index number corresponding to the values in covalRadii
         h1.gameObject.tag = "0";
         h2.gameObject.tag = "0";
         o1.gameObject.tag = "1";
         //Color each atom
         h1.GetComponent<Renderer> ().material.color = Color.white;
         h2.GetComponent<Renderer> ().material.color = Color.white;
         o1.GetComponent<Renderer> ().material.color = Color.red;
         //Finally, store them in the array
         atoms = new GameObject[3] { h1, h2, o1 };
         //Now to find the bonds
         for(int i = 0; i < atoms.Length; i++)
         {
             for(int k = i + 1; k < atoms.Length; k++)
             {
                 float distance = Vector3.Distance(atoms[i].transform.position, atoms[k].transform.position);
                 float sum = covalRadii[int.Parse(atoms[i].tag)] + covalRadii[int.Parse(atoms[k].tag)];
                 if (distance <= sum)
                 {
                     GameObject cyl = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
                     cyl.transform.position = atoms[k].transform.position - atoms[i].transform.position / 2.0f + atoms[i].transform.position;
                     Vector3 v3T = cyl.transform.localScale;      // Scale it
                     v3T.y = (atoms[k].transform.position - atoms[i].transform.position).magnitude;
                     cyl.transform.localScale = new Vector3(0.1f,0.5f,0.1f);
                     cyl.transform.rotation = Quaternion.FromToRotation(Vector3.up, (atoms[k].transform.position - atoms[i].transform.position));
                 }
             }
         }
     }
 }

Unity: 5.5.0f3 Mac: 10.12.2 iOS Software: 10.2

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

122 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Texture looks completely different from texturing program 0 Answers

LineRenderer with Animation curve distorting texture? 0 Answers

Material disappears after LoadScene 1 Answer

Render Pipeline Material Issue 1 Answer

Paint on a mesh and calculate the percentage of what is painted 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges