Développement sur unity

Tout d'abord bonjour et merci a tous ceux qui prendrons le temps de répondre à ce post.

Voilà je suis étudiant en dernières années de master en création numérique et pour la fin d'année nous avons donc un projet professionnel à effectuer que nous choisissons.

Étant infographiste 3D et connaissant déjà un peu unity je me suis donc lancer dans la conception d'un "jeu" ou il est possible d'investir la ville par le biais d'image choisie par l'utilisateur.

Donc pour l'instant en ligne de code j'ai effectué ceci :

-J'ai une boite nommée tableau 1

-Quand j'appuie sur P une boite de dialogue qui s'affiche et me demande de sélectionner une image.

-Une fois l'image sélectionner , l'image s'applique en tant que texture , sur une des faces de la boite.

Mon problème est que je voudrais faire ceci avec plusieurs boites genre 8.

Mais je ne vois pas comment faire pour la suite ... voici le code..

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using UnityEngine;
using System.Collections;
using System.Linq;
// Sets up transformation matrices to scale&scroll water waves // for the case where graphics card does not support vertex programs.
 
[ExecuteInEditMode] public class WaterSimple : MonoBehaviour {
 
string DataPath ;
 
string NewDirectoryForExternalImage ;
 
string ExImagePath;
 
Material CurrentMaterial;
 
private void LoadImage(string ImagePath){
 
// Création du répertoire contenant les futures images à importer   if (!System.IO.Directory.Exists (ExImagePath))
 
System.IO.Directory.CreateDirectory (ExImagePath);
 
// Copy de l'image
 
System.IO.File.Copy (ImagePath,System.IO.Path.Combine (ExImagePath,System.IO.Path.GetFileName (ImagePath)),true);
 
// Construction du chemin de l'image copiée
 
ImagePath = System.IO.Path.Combine (ExImagePath, System.IO.Path.GetFileName (ImagePath));
 
// Changement du protocole d'accès au fichier ( sans cette ligne là ça ne marche plus! )
 
ImagePath = @"file://" + ImagePath;
 
// Création d'un objet à partir de l'image
 
WWW www = new WWW(ImagePath);
 
// Affectation de la texture à la texture courante
 
CurrentMaterial.mainTexture= <a href="http://www.texture;" target="_blank">www.texture;</a>
 
}
 
void Update()  { 
 
DataPath = Application.dataPath; 
 
NewDirectoryForExternalImage = "External Image"; 
 
ExImagePath = System.IO.Path.Combine (DataPath, NewDirectoryForExternalImage);
 
// Récupération du matériaux nommé toto dans 3ds max   // Parcours les matériaux de l'objet courant 
 
CurrentMaterial =gameObject.renderer.materials.Where ( t => t.name.Contains ("toto")).FirstOrDefault ();
 
if (Input.GetKeyDown (KeyCode.P)) {    // Boite de sélection d'une image
 
string ImageToLoad=
UnityEditor.EditorUtility.OpenFilePanel ("Choose image to load into unity",@"C:\","jpg");
 
// Chargement de l'image
 
LoadImage(ImageToLoad);
 
} else if (Input.GetKeyDown (KeyCode.O)) {
 
CurrentMaterial.color = Color.red;
 
// Permet de récupérer tous les objets qui se trouvent dans la scène
 
// System.Collections.Generic.List<GameObject>
Tableaux =UnityEditor.Selection.gameObjects.Where (t => t.name.ToLower ().Contains ("NomDeLobjetDans3DS")).ToList ();
 
}
 
if( !renderer )    return;
 
Material mat = renderer.sharedMaterial;
 
if( !mat )    return;
 
} }
Voila ,

Merci pour vos futur réponse