Im trying to save color to PlayerPrefs, but heard that you can easily save color to PlayerPrefsX. Well, the problem I have is that when im trying to use PlayerPrefsX it says that it is unknown identifier. Im using Javascript so can this be a problem here or should I use something else to save the color.
EDIT:
Here is saving:
#pragma strict
var rotatingEnemy : GameObject;
function Update () {
if(Input.GetMouseButtonUp(0)){
var hit : RaycastHit2D = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
var hitObject = hit.collider;
switch(hitObject.name){
case "Background":
break;
default:
PlayerPrefsX.SetColor("enemyColor", hitObject.renderer.material.color);
rotatingEnemy.renderer.material.color = hitObject.renderer.material.color;
break;
}
}
}
Here is loading:
function Start () {
renderer.material.color = PlayerPrefsX.GetColor("enemyColor");
}
Error code:
Assets/scripts/Game/EnemyChangeColor.js(4,35): BCE0005: Unknown identifier: ‘PlayerPrefsX’.
and
Assets/scripts/ShopPreviewRotatingEnemyColor.js(16,41): BCE0005: Unknown identifier: ‘PlayerPrefsX’.
We need to see your code. Please edit your question to include your script and a copy of the error message from the console.
– robertbuPlayerPrefsX has two versions. Use the Unityscript version, not C#.
– Eric5h5Well, problem solved. Not the first time this kind happens to me, but somehow Unity got bugged and didn't not recognized this file. Went to sleep and after waking up opened up Unity and tried again with no errors. Had same problem with OnClickEvents long time ago, but already forgot restarting fix. Atleast I hopefully remember this next time. :) Thanks for your answers!
– VSmoL