more about user variables

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

Posts: 71
Joined: 04 Dec 2010, 00:44
Location: Asturias

more about user variables

Postby kano » 23 Dec 2010, 00:55

hi.first sorry for my english.
im trying to make my avatar select screen, and i want use user variables.
im using custom login,after that you enter in a room.
If i in my network i use:

Code: Select all

   Hashtable miplayer = new Hashtable();
miplayer.Add("avatarType", male);

ok, i can see the user variables in sfs admin tool.but if i try to make the hastable and send the user vars in other script, i have a error.I dont know what is missing, or what.
The error is tipical:
NullReferenceException: Object reference not set to an instance of an object
menucs.OnGUI () (at Assets\Game\Plugins\menucs.cs:78)

just send this error when you click on this button .The script im using is this:

Code: Select all

using UnityEngine;
using System.Collections;
using System;
using SmartFoxClientAPI;
using SmartFoxClientAPI.Data;

public class menucs : MonoBehaviour {

   private static SmartFoxClient smartFoxClient;

   public static SmartFoxClient GetClient() {
      return SmartFox.Connection;
   private bool started = false;
   private void SubscribeEvents() {
   private void UnsubscribeEvents() {
   void FixedUpdate() {
      if (started) {
public Texture myTexture;
public Texture myTexture2;    
public Texture myTexture3;       

void OnGUI () {

   string male = "male";
if (GUI.Button (new Rect (10,10,myTexture.width,myTexture.height), myTexture)) {
male = "male";


if (GUI.Button (new Rect (150,10,myTexture2.width,myTexture2.height), myTexture2)) {
male = "female";

if (GUI.Button (new Rect (120,140,myTexture3.width,myTexture3.height), myTexture3)) {

   Hashtable miplayer = new Hashtable();
miplayer.Add("avatarType", male);


any idea?im doing diferent test, but i cant found how to fix it.
Thanks.And sorry for my bad english again.

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 3 guests