ProceduralPlanets

◆ CreatePlanet() [2/2]

static Planet ProceduralPlanets.PlanetManager.CreatePlanet ( Vector3  _position,
int  _planetSeed = -1,
string  _blueprintName = "",
string  _jsonString = null 
)
static

Creates a planet.

Can be totally random (if only position parameter is set) and optionally based on a specific seed, blueprint and/or JSON-string.

Parameters
_positionVector3 position of the planet to be created.
_planetSeedOptional random seed used for the planet. Provided that the PlanetManager Material and probability settings are not changed the same seed will generate an identical planet each time.
_blueprintNameOptional forced blueprint name for the planet, e.g. force the planet to be a Terrestrial planet.
_jsonStringOptional JSON string containing the configuration of the planet (can be escaped text or Base64 encoded).
Returns
Planet component (a derived class, like SolidPlanet.cs)



using System.Collections;
public class Example : MonoBehaviour
{
void Start()
{
// Create a totally random planet
PlanetManager.CreatePlanet(new Vector3(-5, 0,0));
// Create a planet with random seed 12345
PlanetManager.CreatePlanet(new Vector3(0, 0, 0), 12345);
// Create a planet with a random seed but force blueprint Terrestrial
PlanetManager.CreatePlanet(new Vector3(5, 0, 0), -1, "Terrestrial");
}
}
See also
CreatePlanet(Vector3, string)