Page 1 sur 1

Probleme interface

Publié : 25 Mars 2020 19:49
par Alkyssprod
Bonjour,

J'ai repris un projet que j'avais sous la version 5.3.0f6

Il fonctionnait très bien. Là je recréé la même version mais sur la 2019.

A la base le menu se présente avec des vignettes que l'on "regarde" pour lancer une nouvelle scène avec un film VR.

Lorsque l'on regarde une vignette et que l'on reste figé dessus, une rectangle bleu (le fameux TargetBG) rempli la vignette et une fois remplie totalement l'expérience se lance.

Le problème est que j'ai beau mettre en parallèle mon ancien projet fais sous l'ancien Unity et la nouvelle version, rien ne change mais le rectangle n'est pas animé et qui plus est ne valide rien.

C'est dans le script ChangeRoom.... ci-dessous :

Impossible voir où est appelé le script animé aussi dans les GameObject. :/

Code : Tout sélectionner

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine.SceneManagement;

public class ChangeRoom : MonoBehaviour {
	public List<Texture2D> textureSphere;
	public string Destination;
	public string NomFichier;
	public float fadeDuration = 3;

	bool inSight = false;
	bool isChanging = false;
	float count = 0;
	float countLerp = 0;
	Animator reticleAnimator; 
	BlackScreen blkScreen;
	GameObject sphereScreen;

	private Color color = new Color(0,0,0,0);
	private int i = 1;

	void Start() {
		reticleAnimator = GameObject.Find ("Reticle").GetComponentInChildren<Animator> ();
		blkScreen = GameObject.Find ("BlackScreen").GetComponent<BlackScreen>();
		sphereScreen = GameObject.Find ("sphere");
	}
	//**** Increase the circle size when you look at it ****\\
	public void IncreaseChildSize(){
		if(!isChanging){
			if (transform.GetChild (0).localScale.x <= 0.9f) {
				transform.GetChild (0).localScale += new Vector3 (.5f * Time.deltaTime, .5f * Time.deltaTime, .5f * Time.deltaTime);
				reticleAnimator.SetBool ("LookSomething", true);
			} else {
				StartCoroutine (FadeChangeRoom ());
				reticleAnimator.SetBool ("LookSomething", false);
			}
			count = 0.5f;
		}
	}
	//**** And decrease it when you're not looking at it ****\\
	void DecreaseChildSize(){
		reticleAnimator.SetBool ("LookSomething", false);
		if(transform.GetChild(0).localScale.x > 0)
			transform.GetChild(0).localScale -= new Vector3(2*Time.deltaTime,2*Time.deltaTime,2*Time.deltaTime);
	}

	void Update(){
		if (count>0){
			count -= Time.deltaTime;
			inSight = true;
		} else inSight = false;

		if(!inSight){
			DecreaseChildSize();
		}
	}
	IEnumerator FadeChangeRoom (){
		isChanging = true;
		transform.GetChild(0).localScale = new Vector3(0,0,0);
		StartCoroutine(blkScreen.FadeOut(fadeDuration));
		yield return new WaitForSeconds(fadeDuration+0.1f);
		//sphereScreen.GetComponent<Renderer>().material.mainTexture = textureSphere[i];
		ApplicationModel.VideoName=NomFichier;
		SceneManager.LoadScene(Destination);
		if(i == textureSphere.Count-1)
			i=0;
		else i++;
		isChanging = false;		
		StartCoroutine(blkScreen.FadeIn(fadeDuration));
		yield return null;
	}

//	void OnGUI(){
//		if (!CardboardOnGUI.OKToDraw(this)) {
//			return;
//		}
//		//color.a = 1;
//		GUI.color = color;
//		GUI.DrawTexture(new Rect(0,0,Screen.width, Screen.height), texWhite);
//
//	}
}

Re: Probleme interface

Publié : 02 Août 2020 16:18
par stigma
C'est très chaud de migrer un projet 5.3 vers 2019. C'est même un peu suicidaire. :|
J'avais essayé de migrer mon projet 5.6.2 vers une 5.7, déjà une tonne de problèmes. Je suis donc resté à la 5.6.2
Pour quelle raison tu veux migrer vers 2019 ?