0
Answered

Need Help with Simple C# Script to recreate it with Bolt

Poly Design 3 years ago updated 3 years ago 3

Hello,

i'm a non coder user here; just trying to understand how bolt works by trying to recreate simple C# scripts written by other people.

I'm trying to recreate this Pixel Perfect Camera script written in C# but i failed.

--------------------------------------------------

using UnityEngine;
using System.Collections;

public class PixelPerfectCamera : MonoBehaviour {

public static float pixelsToUnits = 1f;
public static float scale = 1f;

public Vector2 nativeResolution = new Vector2 (240, 160);

void Awake () {
var camera = GetComponent<Camera> ();

if (camera.orthographic) {
scale = Screen.height/nativeResolution.y;
pixelsToUnits *= scale;
camera.orthographicSize = (Screen.height / 2.0f) / pixelsToUnits;
}
}

}

--------------------------------------------------

I'd be very happy if someone can show me how to do it.

Cheers //

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
GOOD, I'M SATISFIED
Satisfaction mark by Poly Design 3 years ago
+4

I'm not a coder either but I had a crack at it as it's a fun exercise to learn. I'm not sure what the output should be but it does set the size. Here's the macro.