private void OnEnable() { stamp = new GameObject("Stamp"); stamp.hideFlags = HideFlags.HideAndDontSave; bc = target as BlocCreator; if (bc.SelectedPrefab != null) { CreateNewStamp(); } var scriptObject = bc.gameObject; editorPS = PhysicsSceneExtensions2D.GetPhysicsScene2D(scriptObject.scene); scriptableProp = serializedObject.FindProperty("blocsScriptable"); if (bc.currentBlocSelection != null) { blocYRange = bc.currentBlocSelection.blocYRange; gOffset = bc.currentBlocSelection.globalOffsetRange; rotOff = bc.currentBlocSelection.globalRotationOffsetRange; selectedBlocDifficulty = (int)bc.currentBlocSelection.blocDifficulty; blocArea = bc.currentBlocSelection.blockArea; } GetSavedBlocsNames(); RefreshBlocNameAndDiff(); EditorUtility.SetDirty(bc.blocsScriptable); }
void RefreshPaletteImages(BlocCreator bc) { if (palleteImages == null || palleteImages.Length != bc.prefabPallete.Length - 2) // don't take the last two (rage and smaller bonuses) { palleteImages = new Texture2D[bc.prefabPallete.Length - 2]; for (var i = 0; i < bc.prefabPallete.Length - 2; i++) { palleteImages[i] = AssetPreview.GetAssetPreview(bc.prefabPallete[i]); } } }