unity5

Using Fabric with Multidex with an exported Unity project

寵の児 提交于 2019-12-31 04:22:06
问题 I have exported my Unity project to be able to use multidex. Problem is I have to set the android:name in the project's androidmanifest to "android.support.multidex.MultiDexApplication" when I already have this "io.fabric.unity.android.FabricApplication" set for fabric. I have tried initializing Fabric manually but then I get this error : AndroidJavaException: io.fabric.unity.android.FabricInitializationException: Fabric did not find a valid application context. I have found that someone had

Unity - Gameobject look at mouse

牧云@^-^@ 提交于 2019-12-31 01:19:32
问题 I've ran into a problem. The basic setup I have right now, two objects: my camera, and my player object. The player moves via Transform on WASD, and is supposed to rotate on mouse movement. The camera is top down (At a slight "3ps" style angle, which keeps the player object centre to the camera's perspective, and rotates according to the players rotation. This is the players movement script: http://pastebin.com/SvN8FuWs This is the players rotation script: http://pastebin.com/uzZ7SKFL The

In Unity, how to tell if it's the first time a game is being opened?

浪尽此生 提交于 2019-12-28 04:15:14
问题 I want a script to run, whenever my game in Unity is opened for the first time. 回答1: Use PlayerPrefs . Check if key exist. If the key does not exist, return default value 1 and that is first time opening. Also, If this is first time opening set that key to 0 so that if will never return 1 again. So any value that is not 1 means that it is not the first time opening. In this example we can call the key FIRSTTIMEOPENING . if (PlayerPrefs.GetInt("FIRSTTIMEOPENING", 1) == 1) { Debug.Log("First

(42,18): error CS1525: Unexpected symbol (', expecting,', ;', or= [closed]

给你一囗甜甜゛ 提交于 2019-12-27 05:36:17
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I am making a game in unity, where i will make a time system. But im getting this error "(42,18): error CS1525: Unexpected symbol (', expecting,', ;', or='" and i can not find out why i doesnt want work. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public

Why when creating new GameObjects it's not changing the tag? [duplicate]

一世执手 提交于 2019-12-25 09:35:35
问题 This question already has answers here : UnityException: Tag: is not defined (1 answer) Why when Instantiate new GameObjects it's not adding tag to them? [duplicate] (1 answer) Closed 2 years ago . In the first script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class InstantiateObjects : MonoBehaviour { public GameObject prefab; public Terrain terrain; public float yOffset = 0.5f; private float terrainWidth; private float terrainLength; private float

How to change the Start color of the Particle System

不打扰是莪最后的温柔 提交于 2019-12-25 09:06:45
问题 So I am just trying to simply change the start color of a particle system via script, and it's not working. private ParticleSystem trailPartical; // The particle system public Color StartColor { var main = trailPartical.main; main.startColor = value; } This is not working at all, and I have also tried the depreciated version: trailParticle.startColor = value; 回答1: You're trying to use StartColor as a method, judging by the code inside the {}, even though you declared it as a variable. Apart

How to stop rotation by LerpAngle after -90°

徘徊边缘 提交于 2019-12-25 08:53:23
问题 I have colliders where i can turn to the sides and i want camera to rotate as a player turn to the side. I'm using Mathf.LerpAngle for that, but when I press the key for turn to side, camera is rotating in loop. How can I make rotation stop? The problem is that everytime I turn player should go -90 degrees to the left +90 to the right and there will be more turns so i can't use functions for setting rotation. I was already trying to make it stop by that if statement with (lAngle > 90f) float

How assign values from a csv file to a array or list

人盡茶涼 提交于 2019-12-25 07:46:14
问题 Currently i'm developing a quiz kind of game. I've managed to develop the basic working of it. I was using the serialized field for updating the questions. Now i'm planning to use a CSV file for the questions. CSVReader using UnityEngine; using System.Collections.Generic; public class CSVReader : MonoBehaviour { public TextAsset csvFile; [System.Serializable] public class Row { public string Id; public string Fact; public string IsTrue; } public static List<Row> rowList = new List<Row>();

How can I access shader variables from script?

ぃ、小莉子 提交于 2019-12-24 21:46:39
问题 The shader: // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' Shader "Outlined/Silhouetted Diffuse" { Properties { _Color ("Main Color", Color) = (.5,.5,.5,1) _OutlineColor ("Outline Color", Color) = (0,0,0,1) _Outline ("Outline width", Range (0.0, 0.03)) = .005 _MainTex ("Base (RGB)", 2D) = "white" { } } CGINCLUDE #include "UnityCG.cginc" struct appdata { float4 vertex : POSITION; float3 normal : NORMAL; }; struct v2f { float4 pos : POSITION; float4 color :

How to Rewind Video Player in Unity?

你离开我真会死。 提交于 2019-12-24 21:10:08
问题 I am attempting to rewind a VideoPlayer in Unity, also I am using the new VideoPlayer API and an mp4. I have tried setting the playback speed to a negative number, but it pauses. My current solution is In my rewind button script: void Update () { if (rewind == true) { VideoController.Backward2Seconds(); } } In my VideoController Script public void Backward2Seconds() { if (!IsPlaying) return; videoPlayer.time = videoPlayer.time - 2; } Is there a better way? Because this is laggy. 回答1: