简体   繁体   English

关于问题的Unity Quiz游戏图像

[英]Unity Quiz Game image on questions

How can I input image to be my questions on my quiz game app. 如何在问答游戏应用中输入图像作为我的问题。 I've managed to have the image script but I can't see any images 我设法有了图像脚本,但是看不到任何图像

Here is my code for the Game Controller which holds the data of the game. 这是我保存游戏数据的游戏控制器代码。 Here's an image of the Game Controller Game Controller will look like this 这是游戏控制器的图像游戏控制器将如下所示

 public Sprite quizImage;
    public TSSimpleObjectPool answerButtonObjectPool;
    public Text questionText;
    public Text scoreDisplay;
    public Text timeRemainingDisplay;
    public Transform answerButtonParent;

public GameObject questionDisplay;
public GameObject roundEndDisplay;
public Text highScoreDisplay;

The problem is image does not show when i run the app. 问题是我运行应用程序时图像未显示。 What is the problem? 问题是什么?

"Image doesn't show" could mean multiple things. “图像未显示”可能意味着多种情况。 You really need to clarify. 您确实需要澄清。

But here are some quick fixes from my experience. 但是,根据我的经验,这里有一些快速修复方法。 (Common error: "Image doesn't show") (常见错误:“图片未显示”)

a) Make sure you look at the parameters when looking at Unity. a)确保在查看Unity时查看参数。 When you superimpose images in unity (ie putting a background with a image), it's a common issue that sometimes images cover each other. 当您将图像统一叠加时(即将背景和图像放在一起),这是一个常见的问题,有时图像会相互覆盖。 You have like 5 images/text in your picture... make sure your paying attention to z values. 您的图片中有5张图像/文字...请确保注意z值。

b) You need to looking into prefabs. b)您需要研究预制件。 IE dragging an image into the hierarchy and dragging it back to assets usually does the trick. IE将图像拖入层次结构并将其拖回资产通常可以解决问题。 Get the prefab -> drag it into the public gameobject. 获取预制->将其拖到公共游戏对象中。 Judging by how you haven't plugged in a sprite in your image means you can't to figure out how ton drag objects in. 从您尚未在图片中插入精灵的方式判断,您就无法确定将对象拖入的方式。

Some documentation on prefabs https://docs.unity3d.com/Manual/Prefabs.html 有关预制件的一些文档https://docs.unity3d.com/Manual/Prefabs.html

c) You're mixing up Sprites and GameObjects together. c)您将Sprite和GameObject混合在一起。 Look up differences between the two and post again. 查找两者之间的差异,然后再次发布。

d) Make sure you are not plugging in a blank sprite. d)确保您没有插入空白精灵。 If you want to use sprites, make sure you know how to attach to image to them. 如果要使用精灵,请确保您知道如何将图像附加到精灵上。 You can follow this tutorial down here. 您可以在此处遵循本教程。

https://docs.unity3d.com/Manual/SpriteEditor.html https://docs.unity3d.com/Manual/SpriteEditor.html

Second of all, sprites are used in unity 2D, not unity 3D. 第二,精灵用于统一2D,而不是统一3D。 They are 2D graphical objects... stop mixing up the two. 它们是2D图形对象...不要再混淆两者。

Hope this helped. 希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM