x


Setting default values for a different class, similar to vector3

Im trying to create a class similar to Vector3, which allows the default values to be set in the editor.

I set the default values for Vector3 and Vector3i(my class) in a separate class.

public Vector3 pos=new Vector3(0,5,0);
public Vector3i centre=new Vector3i(0,5,0);

In the editor it shows the default values for vector3 as x=0,y=5,z=0. But Vector3i(my class) sets the default values at x=0,y=0,z=0.

Vector3i(my class)

using UnityEngine;
using System.Collections;

[System.Serializable]

public class Vector3i{
 public int x,y,z;

 public Vector3i(int x,int y,int z){
 this.x=x;
 this.y=y;
 this.z=z;
 }

 public void convert(Vector3 v){
 x=Mathf.RoundToInt(v.x);
 y=Mathf.RoundToInt(v.y);
 z=Mathf.RoundToInt(v.z);
 }

}
more ▼

asked Jul 15 '12 at 08:30 PM

FlyingOstriche gravatar image

FlyingOstriche
264 1 6 10

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x578
x337
x123
x62
x9

asked: Jul 15 '12 at 08:30 PM

Seen: 431 times

Last Updated: Jul 15 '12 at 08:30 PM