Hello everyone, I’m make simple game and I want to do it simple health system.
There are four health points and if so will restart the level for the price of one life pint.chtěl I need something like this
if (Hp == 4) { // Render to texture something called Hp-4 … }
maybe use a switch but that’s not important.
In short, I need something to render texture in the UI of a certain size in a particular place, it would be best to have the UI only one object (picture) and changed his image.
btw. csharp use and I want him to have the whole game … please no java
ps. sorry for bad English, I’m from the Czech Republic and to know C # and English on the 17-year-old boy a bit too much
If your English comprehension is good enough, I suggest checking out the official tutorials for the new UI system to give you an idea of its fundamentals.
For this specific request, you can change the image’s texture property, like so:
public Texture hpTexture1;
public Texture hpTexture2;
public Texture hpTexture3;
public Texture hpTexture4;
switch(hp){
case 1: myImage.texture = hpTexture1;
break;
case 2: myImage.texture = hpTexture2;
break;
case 3: myImage.texture = hpTexture3;
break;
case 4: myImage.texture = hpTexture4;
break;
}
To see what kind of properties or functionality a component has, please check out the reference manual.
And don’t worry, your English is fine! The only thing I’ll correct though is that Unity’s other main language is called UnityScript, often called JavaScript. However, Java is yet another language, though totally unrelated to both Unity and JavaScript.