MeshRenderer class final
Draws mesh with material at the object's Transform. Without both,
nothing is drawn. Change it in place: get<MeshRenderer>()!.material = gold.
A material is shared: every renderer that has it changes when it does. For one object alone, set color (a hit flash, a team colour), or give it its own material with Material.copy.
It casts shadows and shadows fall on it, as in Unity; turn either off
with castShadows and receiveShadows
(MeshRenderer(water, glass)..castShadows = false).
Constructors
- MeshRenderer([Mesh? _mesh, Material? _material])
- Draws mesh with material: both are optional, and can be set later, but nothing is drawn until it has both.
Properties
- castShadows ↔ bool
-
Whether it blocks the light of lights with Light.shadows: true
unless set. Off for what shouldn't darken the ground: water, a glow,
a ghost.
getter/setter pair
- color ↔ Color?
-
This object's own base colour, in place of its material's, which
stays as it is for the other objects that share it (Unity's
MaterialPropertyBlock). Null, as at first, for the material's.colorTotweens it.getter/setter pair - enabled ↔ bool
-
Whether it's on (Unity's
enabled). Off, a Camera draws nothing, a Light lights nothing (and isn't one of a frame's 64 lamps), a MeshRenderer draws nothing, and a Behaviour gets none of its object's frames or pointers; its object and its other components go on as they were. It keeps what it was given, and changes made while it's off show when it's on again.getter/setter pairinherited - gameObject → GameObject
-
The object it's on. Throws a StateError before it's given to one.
no setterinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- isRemoved → bool
-
Whether it was taken off its object (GameObject.removeComponent) or
its object was destroyed. It can still be read, but not used; one
that went with its object is still found by the object's
GameObject.get.
no setterinherited
- material ↔ Material?
-
How its surface looks; null draws nothing. Shared: changing the
material changes every object that uses it (as Unity's
sharedMaterial, not itsmaterial, which Unity copies per renderer). For this object alone, set color or give it a Material.copy.getter/setter pair -
materials
↔ List<
Material> -
One material for each part of its mesh (Unity's
sharedMaterials): the first is material, and draws the first part; each after it draws the next part (Mesh.setTriangles'submeshStarts). A part without one isn't drawn. A list of one is material alone.getter/setter pair - mesh ↔ Mesh?
-
The shape it draws; null draws nothing. A mesh can be on any number
of renderers.
getter/setter pair
- receiveShadows ↔ bool
-
Whether shadows fall on it: true unless set.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transform ↔ Transform
-
Its object's GameObject.transform.
getter/setter pairinherited
Methods
-
ancestor<
T extends GameObject> () → T? -
The nearest object above its object that is a
T, or null: see GameObject.ancestor.ancestor<ArenaGame>()finds the game a behaviour's object is in.inherited -
get<
T extends Object> () → T? -
Its object's component of type
T: see GameObject.get.inherited -
getAll<
T extends Object> () → List< T> -
Its object's components of type
T: see GameObject.getAll.inherited -
getAllInChildren<
T extends Object> ({bool includeInactive = false}) → List< T> -
Every component of type
Ton its object and below it: see GameObject.getAllInChildren.inherited -
getInChildren<
T extends Object> ({bool includeInactive = false}) → T? -
The first component of type
Ton its object or below it: see GameObject.getInChildren.inherited -
getInParent<
T extends Object> ({bool includeInactive = false}) → T? -
The first component of type
Ton its object or the nearest one above: see GameObject.getInParent.inherited -
has<
T extends Object> () → bool -
Whether its object has a component of type
T.inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
number(
String name) → double -
This object's own number
name(set): 0 until set. -
set(
String name, double value) → void -
Sets this object's own number
name, one of its material's shader'sPerObject(Shader.perObject), leaving the other objects that share the material as they are: a hit flash, a dissolve, a team's tint. 0 until set. Throws an ArgumentError for a name the shader doesn't have, or a number that isn't finite, and a StateError without a material with a shader. To tween one:tween(1.0, 0.0, seconds: 0.2, onUpdate: (v) => renderer.set('flash', v)). -
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited