Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
265 views
in Technique[技术] by (71.8m points)

android - objects are all pink in the apk, but fine in the Unity Editor

I am running Unity 2020.2.2f1 on linux, and I am unable to get the correct rendering in the APK. The simple example below runs fine in the editor, with a red sphere and blue plane, but when I generate the APK the plane and the sphere are pink. But they are visible and the sphere is moving. It's just all pink. I have tried it on three different Android devices, including two Samsungs, and the output is always the same.

I have read a number of messages with similar problems, and have tried all kinds of things, unselecting 32 bit, etc., to no avail. If I install the Universal Render Pipeline, it is even worse, as the objects vanish entirely from the scene.

Is there an easy way to fix this?

Thanks.

using UnityEngine;

public class Example : MonoBehaviour
{
  GameObject plane,sphere;
  void Start()
    {
      plane = GameObject.CreatePrimitive(PrimitiveType.Plane);        
      sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
      Renderer rend = plane.GetComponent<Renderer>();
      rend.material.SetColor("_Color", Color.blue);
      rend = sphere.GetComponent<Renderer>();
      rend.material.SetColor("_Color", Color.red);
      Camera.main.transform.position = new Vector3(0, 1, -5);
    }
  void Update()
    {
      sphere.transform.Translate(new Vector3(0.0f,0.01f,0.0f));        
    }
}


question from:https://stackoverflow.com/questions/65863320/objects-are-all-pink-in-the-apk-but-fine-in-the-unity-editor

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...