x


The name 'Decal' does not denote a valid type ('not found')

I have gotten this error:

The name 'Decal' does not denote a valid type ('not found')


pragma strict

pragma implicit

pragma downcast

enum HitType { CONCRETE, WOOD, METAL, OLD_METAL, GLASS, GENERIC }

class BulletMarks extends MonoBehaviour { public var concrete : Texture2D[]; public var wood : Texture2D[]; public var metal : Texture2D[]; public var oldMetal : Texture2D[]; public var glass : Texture2D[]; public var generic : Texture2D[];

public function GenerateDecal(type : HitType, go : GameObject) { var useTexture : Texture2D; var random : int;

switch(type)
{
    case HitType.CONCRETE:
        if(concrete == null) return;
        if(concrete.Length == 0) return;

        random = Random.Range(0, concrete.Length);

        useTexture = concrete[random];
        break;
    case HitType.WOOD:
        if(wood == null) return;
        if(wood.Length == 0) return;

        random = Random.Range(0, wood.Length);

        useTexture = wood[random];
        break;
    case HitType.METAL:
        if(metal == null) return;
        if(metal.Length == 0) return;

        random = Random.Range(0, metal.Length);

        useTexture = metal[random];
        break;
    case HitType.OLD_METAL:
        if(oldMetal == null) return;
        if(oldMetal.Length == 0) return;

        random = Random.Range(0, oldMetal.Length);

        useTexture = oldMetal[random];
        break;
    case HitType.GLASS:
        if(glass == null) return;
        if(glass.Length == 0) return;

        random = Random.Range(0, glass.Length);

        useTexture = glass[random];
        break;
    case HitType.GENERIC:
        if(generic == null) return;
        if(generic.Length == 0) return;

        random = Random.Range(0, generic.Length);

        useTexture = generic[random];
        break;
    default:
        if(wood == null) return;
        if(wood.Length == 0) return;

        random = Random.Range(0, wood.Length);

        useTexture = wood[random];
        return;
}

transform.Rotate(new Vector3(0, 0, Random.Range(-180.0, 180.0)));

Decal.dCount++;
var d : Decal = gameObject.GetComponent("Decal");
d.affectedObjects = new GameObject[1];
d.affectedObjects[0] = go;
d.decalMode = DecalMode.MESH_COLLIDER;
d.pushDistance = 0.009 + BulletMarkManager.Add(gameObject);
var m : Material = new Material(d.decalMaterial);
m.mainTexture = useTexture;
d.decalMaterial = m;
d.CalculateDecal();
d.transform.parent = go.transform;

}

} Blockquote

more ▼

asked Mar 13 '11 at 11:27 AM

Oliver 5 gravatar image

Oliver 5
1 1 1 1

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

3 answers: sort voted first

I find problem why it doesn't work it's working only if decal scripts in Standard Assets folder. (assets/Standard Assets)

more ▼

answered Nov 12 '11 at 02:37 PM

loihb gravatar image

loihb
120 4 9 16

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

If you are working from the boot camp demo(which I assume you are), then make sure that there is the editor folder for the decal editor, or else this script will not work!!! :)

more ▼

answered Mar 13 '11 at 12:25 PM

zmar0519 gravatar image

zmar0519
946 59 66 78

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

i am having the exact same problem and i have the editor folder with decaleditor.cs in it but nothing has happened. does it need to be in a certain place or is there anything else that needs to be done to make it work

more ▼

answered Apr 20 '11 at 03:18 PM

monty gravatar image

monty
10 6 6 8

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x1937
x198
x29

asked: Mar 13 '11 at 11:27 AM

Seen: 2129 times

Last Updated: Nov 12 '11 at 02:37 PM